Jump to content

Recommended Posts

Posted

Hello,

I'm using WireCache with matrix repeater. Usually it works fine, but on occasion it seems to cache nothing instead of the actual content and serves a totally blank page, which then wont go away until someone manually clears it out.

I've also added a hook in ready.php that will clear out any related cache on page save. That seems to work fine, when cache is working correctly, but when it saves "empty" the hook does not function either, which I find pretty peculiar.

I'm just here to double check I'm using the cache correctly

Inside the matrix repeaters php file:

foreach ($value as $item) {

	if ($item->type !== 'matrixForm' && $cache->get('page_' . $page->id . '_item_' . $item->id, $cacheTime)) {
		echo $cache->get('page_' . $page->id . '_item_' . $item->id);
	} else {

		ob_start();

		// Matrix item HTML/PHP here

		$cacheValue = ob_get_clean();
	
		if($item->type !== "matrixForm") {
			$cache->save('page_' . $page->id . '_item_' . $item->id, $cacheValue, $cacheTime);
		}
	
		echo $cacheValue;
	
	}
}

There are few item types that are not supposed to get cached, 'matrixForm' being an example.

  • 3 weeks later...
Posted

@ryan Can you take a look at this? If I'm using the cache wrong it would be great to know. But if it's correct then there's definitely something funky going with the cache itself.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...