Jump to content

WireCache behaviour


MSP01
 Share

Recommended Posts

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.

Link to comment
Share on other sites

  • 3 weeks later...

@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.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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