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 :

or

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 www.domain.com/customflush.php

Refresh magento cache programmatically
The following two tabs change content below.
Jyotiranjan is one of passionate programmer who has been working in magento since 6 years and in the mean time he has developed enormous amount of modules and customisation of sites. He loves to write blogs and travel for long journeying.

Latest posts by Jyotiranjan Biswal (see all)

Tagged on:                 

Leave a Reply

Your email address will not be published. Required fields are marked *