I'm using a call to Mage::getSingleton('core/cache')->save() within a controller of mine and it's saving the cached value to the file system (var/cache/) even though Redis is configured as my cache backend, and seemingly all other cache in Magento is being saved properly to Redis.

Here's the save() call:

Mage::getSingleton('core/cache')->save($imageUrl, $cacheKey, array(Mage_Core_Model_Config::CACHE_TAG));

Here's my app/etc/local.xml:


Why is it saving that cached value to the file system instead of Redis?


1 Answer 1


You should be using Mage::app()->getCache()->save() as the cache gets initialised in the getCache() method by fetching the config and setting this for the cache object, whereas the Mage_Core_Model_Cache constructor does not do this, as far as I can see and it will revert back to the default caching model.

Did a quick test with:

Mage::getSingleton('core/cache')->save(now(), 'time123', array(Mage_Core_Model_Config::CACHE_TAG)); 


Mage::app()->getCache()->save(now(), 'time12345', array(Mage_Core_Model_Config::CACHE_TAG));

Further info:

Mage_Core_Model_App::_initCache actually uses the following to set up the cache object:

$this->_cache = Mage::getModel('core/cache', $options);

Which means the core cache object is not added to the registry for use as a singleton. The first time you call it as a singleton a new core cache object is created and the constructor is called without any options.

  • 1
    Wow, I'm feeling a little bit sheepish right now. That worked! Thanks! Sep 24, 2014 at 21:26

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.