1

I'm trying to cache my menu module like this:

$cache = Mage::app()->getCache();

if(!($cachedMenu = $cache->load("super_menu_".$child->getId())))
{
   ....blah blah blah .... generating some string ...

   $cache->save("super_menu_".$child->getId(),$str);
}
else
   echo $cachedMenu;

But It seems everytime it tries to generate the menu, I'm using Redis as my caching system and it works great for other parts of my codes. I don't know if I missed something here or not.

1

I think you have a problem in the order of your save attributes. I think it should be Value then cache key.

public function save($data, $id, $tags = array(), $lifeTime = null)

What I think you are doing is saving the string as the id and so your load does not find anything.

Some good notes on cache can be found here https://www.nicksays.co.uk/developers-guide-magento-cache/

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.