Refresh magento cache programmatically
Refresh magento cache programmatically

Now a days every frame-work using caching system for making website faster ans faster. Among these race magento is one of them and also uses excellent caching system in its structure. Magento has these ‘apc’, ‘memcached’, ‘xcache’,’zendserver_shmem’, ‘zendserver_disk’, ‘varien_eaccelerator’ caching engine to cache all files into cache files.So from these sysetm if we want manage to refresh then we can do easily by just accessing cache model and using that methods.So amongg from those some of possibilities are explained below.So lets take a look how we Refresh magento cache programmatically.
If you call Mage::app()->getCacheInstance()->getTypes() then the possible types will be as follows:

  • config
  • layout
  • block_html
  • translate
  • collections
  • eav
  • config_api
  • config_api2

So if you want to flush individually and want to skip some cache type then you can use below code :


But if you want to flush total cache of magento store then you can use the below code:

but in some cases you want to do it through custom script then you can use below code as I have prepared below code a stand alone script.You can place that php file in root directory of magento and run that in browser followed by base url like

Refresh magento cache programmatically
Tagged on:                 

Leave a Reply

Your email address will not be published.