Magento Flash Storage

I understand the difference between "Flush Magento Cache" and "Flush Cache Storage" in Magento ( example ). I am trying to work on a cron job that will clear the cache from time to time.

I assume that this button does not just delete the contents of var / cache /, but I cannot find a reliable resource that says what it does. I use APC, as well as all of Magento's built-in caching features.

Can I run the equivalent of the Fluch Cache Storage button using a script?

+7
source share
2 answers

In app/code/core/Mage/Adminhtml/controllers/CacheController.php you will see that flushAllAction() called (the action that is called when Flush Cache Storage clicked).

This function contains the following:

 /** * Flush cache storage */ public function flushAllAction() { Mage::dispatchEvent('adminhtml_cache_flush_all'); Mage::app()->getCacheInstance()->flush(); $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("The cache storage has been flushed.")); $this->_redirect('*/*'); } 

To call this in your own file, you can do the following.

 require_once('app/Mage.php'); Mage::app()->getCacheInstance()->flush(); 

Now you can run your php file using cronjob.

+10
source

here you can find a good explanation of the differences between Flash Storage and Flush Magento Cache.

I agree that you should create a CRON TASK (if a clean cache is really needed) ( how ) using the method:

 public function flushAllAction() { // Additional code if necessary Mage::app()->getCacheInstance()->flush(); // Additional code if necessary } 

If you need more help, feel free to ask.

+3
source

All Articles