Magento Cache: How And Why Your Store Needs It

In order to increase the volume of visits on your site, it is very important to optimize it. Caching plays a good role in this process.

Let us review how to flush the cache in Magento ®. Also it should be mentioned that you can find many modules for Magento ® for cache work.

General Magento Cache information

You may learn more information about the available ways to caching in Magento ® (apc /memcached /xcache /file) here:


The cache function is used to store the history of website visits. Any internet browser used at this time automatically stores all data about visited sites, requests, etc, in a special folder on the hard drive. This makes the ‘computer – web’ operation and pages loading much faster.

This is how browser caches the information. But Magento ® cache works in a slightly different way. Magento ® Cache is a tool that caches specific pages, page blocks, database requests, etc. This information is stored on the server (not on the local PC of the site visitor) and, when a query is done again, Magento ® does not create the data anew but takes it from the cache.

In other words, when you access a specific site using an internet browser, it stores the information received from that site in its cache; if then you close it, open again and access the same site, now the browser will not use traffic to load the whole page, but will take a cached copy and check if there have been any changes on the actual page compared to the cached information, and due to this the web page will be loaded faster than the first time.

The cache function in Magento ® helps to make the process of products loading in the store faster, which attracts users and potential customers. But the main peculiarity of this Magento ® option is that, if you change the product category, description, add new products, etc, make any changes in your store, then you will need to refresh your Magento ® cache in order for your store to be displayed properly by the end users’ browser.

There are several ways to flush Magento ® cache, the easiest one is to simply refresh it using your admin panel. But, if you have a module of website integration with other systems, e.g. with search engines, shopping systems, etc, then this is not the best variant as the information needs to be updated for those systems as well. In this case, you will need to modify some .php files or create a new one that will automatically enable the cache refreshing.

You may use the following script for flushing your store cache:

/*enable app/Mage.php*/
    require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR. 'app' . 
    $app = Mage::app('admin', 'store');
    if($app->cleanCache()) {
    	Mage::log("Successfully was cleared the cache.");
    	//echo 'Successfully was cleared the cache.';
    } else {
    	Mage::log("An error occurred while flushing the cache.");
    	//echo 'An error occurred while flushing the cache.';


This file should be located in shell/cacheRefresh.php folder and the cache flushing interval should be specified, e.g. every hour or every day.

After that flushing and refreshing of Magento ® Cache will be done automatically according to the time interval you specify.

If you have any questions related to Magento ® cache functionality, please feel free to contact GoMage experts by leaving a comment on this article.

Contact us
Fill in the data using social media accounts
Thank you!
We will contact you shortly
Subscribe to Newsletter Learn the main secrets of creating a successful eCommerce project