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? Jun 26, 2015 at 18:59
  • It should. Have you tried it?
    – mbalparda
    Jun 26, 2015 at 19:08
  • how would one define or find a specific cache tag? 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
    Jun 26, 2015 at 22:18

Your Answer

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

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