Magento cache does caching system at many levels from Zend Framework, so as to boost up your Magento e-commerce store. Magento Cache avoids repetitive operations for your Magento.
Magento cache includes configuration files(config.xml, local.xml), html files, web services xml files (used for apis), images, javascript files, css etc.
If we want to clear/flush magento cache we simply goto System > Cache Management and click Flush Magento Cache.
But, what if we need to clear it programatically. Often we get invalidated status in front of cache types, after running some scripts or massupload of products.

We can simply run this code to flush Magento cache.

This will clear all the cache levels. If you want to clear any specific type.

in case you don’t know types of cache you can simple,

Combining above two codes

💡Bonus script to clean all cache including images and js/css 😆 buy me drink after this

Add it to your Magento root folder and open it from browser. (

If you have any other ideas please do share with me.

Thanks 🙂