0

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 1

3

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]);

8
  • Where would I call this removeCache method? Jun 22, 2015 at 14:31
  • 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
    – Sander Mangel
    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? 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
    – Sander Mangel
    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. Jun 22, 2015 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.