I understand the difference between "Flush Magento Cache" and "Flush Cache Storage" in Magento (example). I'm trying to work on a cron job that will flush the cache storage from time to time.
I'm assuming that this button doesn't just remove the contents of var/cache/, but I can't find a solid resource that says what it does. I am using APC as well as all the inbuilt Magento cache features.
Is it possible to run the equivalent of the "Fluch Cache Storage" button from a script?
In the app/code/core/Mage/Adminhtml/controllers/CacheController.php
, you can see that flushAllAction()
(the action that is called when you click Flush Cache Storage
) is called.
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 a cronjob.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With