4

i'm using memcache and redis. is it possible to clear only a certain page or group of pages using these? Howso? For example i'd like to be able to only clear the homepage instead of the entire FPC.

Thanks.

1 Answer 1

3

If you know the tags of the pages you can remove only those using

    $cache = Mage::app()->getCache();
    foreach($cache->getTags() as $tag){
        if(strpos($tag, 'my_cache_tag')){
            $ids = $cache->getIdsMatchingAnyTags(array($tag));
            foreach($ids as $id){
                $cache->remove($id);
            }
        }
    }

This can also be used to find out the keys you want to delete inspecting the content of the $cache->getTags() object. Source here.

Here is a good guide for Magento cache management too.

4
  • does this work with FPC? Commented Jun 26, 2015 at 18:59
  • It should. Have you tried it?
    – mbalparda
    Commented Jun 26, 2015 at 19:08
  • how would one define or find a specific cache tag? Commented Jun 26, 2015 at 20:45
  • In the second link you will find out how to create cache with a tag and how to manipulate it once created. To find out a tag you will have to look into the core or maybe dump the content of $cache->getTags() object.
    – mbalparda
    Commented Jun 26, 2015 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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