I'm using FPC with redis. I'd like to be able to flush the homepage or category pages from this page. How to I add these items to the Cache Storage Management? Hole punching? But how do I link the hole punching to the Cache Storage Management?
1 Answer
the items shown there are the cache items available. Since homepage and category pages are in FPC you can't display them separately.
This would require you to add a custom cache item.This tutorial explains how. Basically you need to define it in a custom modules config.xml
<global>
<cache>
<types>
<[custom_cache_name]module="[namespace]_[module]" translate="label description">
<label>Custom cache</label>
<description>A custom cache</description>
<tags>[CUSTOM_CACHE_TAG]</tags>
</[custom_cache_name]>
</types>
</cache>
</global>
and then write an observer that displays and one that saves the output of a whole page to that cache
Fetching it would be something like
$isActive = Mage::app()->useCache('[namespace]_[module]');
if ($isActive) {
// Cache is active
$cacheId = 'YOUR_CACHE_' . Mage::app()->getStore()->getId() . '_homepage';
if ($cacheContent = Mage::app()->loadCache($cacheId)) {
return $cacheContent;
}
}
// if not active or no content render page as normal
But stuff like normal FPC hole punching etc is missing here. It would basically require you to completely rebuild an FPC module.
Another option would be to find a way to check which cache IDs are homepage or category page and make a script that removes those with
Mage::app()->removeCache([some_cache_id]);
-
-
some custom written script you call. How you want to do that is up to you. It can be a shell script or a controller in the backend that executes the code Commented Jun 22, 2015 at 14:37
-
So i'd have to disable FPC for homepage and category pages and add those pages (like above) to my custome defined cache? Commented Jun 22, 2015 at 14:46
-
Yup, but I wouldn't advice something like that. It's a lot of work if you get it to work at all Commented Jun 22, 2015 at 14:47
-
Okay thanks, i'm just trying to determine a way to flush these sections individually while keeping things like FPC functional. Commented Jun 22, 2015 at 14:48