Knowledgebase

How to purge the cache in PrestaShop

PrestaShop has a few different cache options. To clear the cache in PrestaShop you may need to delete cached files in several different folders depending on the options that you have enabled, and also on which cache exactly you want to purge. As an example, we'll assume that your PrestaShop is installed in a folder called prestashop in the root public_html directory on your PrestaShop hosting account.

Smarty Template Compiler and Cache

We'll start with the cache that's enabled by default. In PrestaShop there's a tool called Smarty which compiles and caches the template files of the theme. You can clear this cache by manually deleting the cached files. You can do it from the Files section of the Pixie control panel or you can use an FTP client. Using the above example of the location of PrestaShop on your account and assuming that you use a version of PrestaShop older than 1.5 (e.g. PrestaShop 1.4), the path to the cached files would be public_html/prestashop/tools/smarty/cache. Just delete all the files in that folder. The compiled files are store respectively in public_html/prestashop/tools/smarty/compile. You can clear them as well; don't delete only the index.php file. If you use PrestaShop 1.5 the paths to the cached files and the compiled ones are a bit different compared to older PrestaShop versions; they will be public_html/prestashop/cache/smarty/cache and public_html/prestashop/cache/smarty/compile respectively.

Clearing the cached and compiled files is useful, for example, when you make changes to the template files. In this way you'll be able to see the changes when you refresh the frontend. In this case another thing you can do is to enable the Force Compile option. In PrestaShop older than 1.5 you can do this from backend>Preferences tab>Performance sub-tab. Just don't forget after you're done to disable the option. Otherwise, the page loading time will decrease. PrestaShop 1.5 introduced an additional option so that you don't have to enable and disable the force compile each time you modify template files. This option should be enabled by default. To check this, log in to the admin panel and go to Advanced Parameters menu>Performance sub-menu and make sure the option Template cache is set to Recomplile templates if the files have been updated.

CSS and JavaScript Cache

Other options that include caching are the CCC (Combine, Compress and Cache) settings. They are disabled by default; you can enable them from the backend (Preferences tab>Performance sub-tab in PrestaShop older than 1.5, and Advanced Parameters menu>Performance sub-menu in PrestaShop 1.5). This will compress, combine and cache the theme's CSS, HTML, and JavaScript files. Using the above example of the location of PrestaShop on your account, and assuming you use the default prestashop theme, you can find and delete these combined and cached files in public_html/prestashop/themes/prestashop/cache. Delete all the files except index.php.

File System Cache

PrestaShop also offers another caching option which is disabled by default. You can enable it from the Performance sub-tab of the Preferences main tab in versions older than PrestaShop 1.5 and from Advanced Parameters menu>Performance sub-menu in newer ones; it's at the bottom of the page. There's a choice between Memcached and File System cache, and some other caching systems if you use PrestaShop 1.5. On HostKnox servers you can use the File System Cache option. After you enable this option many folders will be created in public_html/prestashop/cache/cachefs. Different cached files will be stored in these folders.

One way to clear all these cached files is to go to the Performance sub-tab of your backend, then to disable the File System cache option and to enable it again. This will delete the old folders inside public_html/prestashop/cache/cachefs and will replace them with new folders without cached files in them. Otherwise you have to delete manually all the folders, but then if you want to use this cache option, you have to disable and enable it again, so as to create the folders for the cached files again.

You'll also find some information on these cache settings in the tutorial on speeding up PrestaShop.

Was this answer helpful?

 Print this Article

Also Read