What is the code for clean or refresh the cache programmatically because I have got lots of snippets but all are not working in Magento 1 enterprise edition.
Does anyone know how to solve it? Thanks in advance.
What is the code for clean or refresh the cache programmatically because I have got lots of snippets but all are not working in Magento 1 enterprise edition.
Does anyone know how to solve it? Thanks in advance.
To clean cache use this:
Mage::app()->cleanCache();
To flush cache use this:
Mage::app()->getCacheInstance()->flush();
You can also use this if you are trying to flush specific cache:
$tags = Mage::app()->getCacheInstance()->cleanType($type);
Mage::dispatchEvent('adminhtml_cache_refresh_type', array('type' => $type));
Possible types are as follows:
Reference: How can I programmatically flush Magento's Cache?
Note: You might face problem if you are doing it on frontend. Make sure you do it on admin area.