How to enable Cache in Joomla
- by Editorial Staff
- on Tutorials
There is one guaranteed way to improve the performance of your Joomla website and that is enabling Caching.
Fortunately, Joomla provides a flexible set of tools to achieve various configurations which suit many cases. Ranging from full page indiscriminate caching to caching based on each module's settings.
View & Module Caching in Joomla
We shall start by describing the finer caching mechanism that is view & module caching in Joomla.
First of all we need to enable caching through the Global Configuration. To do that, login to your administrator panel and navigate to System > Global Configuration.
Then, to find the Cache Settings you need to click on the "System" Tab.
As you can see from the screenshot below, there is a section called "Cache Settings" which starts with a "Cache" selection box. Go ahead and select "ON - Conservative Caching" or "ON - Progressive Caching" to reveal all the extra caching options.
Conservative Caching
Conservative Caching is the minimal caching that can be provided by Joomla. By choosing "ON - Conservative Caching" you are able to switch off the Caching for each and every one of your modules by navigating to their Advanced Settings.
Progressive Caching
Progressive Caching, as opposed to Conservative Caching, will not take into consideration the Caching option of each module. Instead, it will take a complete snapshot of all the modules on every different page of your Joomla Website.
This option can be used on webpages which have modules that serve static content and there is no need for exceptions.
Cache Handlers
A Cache Handler is basically the type of mechanism Joomla uses to create the cache. By default, Joomla uses the "File" Cache Handler.
There are other Caching mechanisms available but in order for Joomla to use them, they must have been installed to the server beforehand. Such mechanisms are, for example, memcache, redis and APC.
Platform Specific Caching
This option fixes the problem in which Joomla serves a different page if it is viewed by a mobile or a desktop. Do not confuse this option with responsive websites because responsiveness can still work fine with or without caching.
Activate this option if your Joomla website has a completely different mobile version.
Cache Lifetime
As its name suggests, Cache Lifetime is the amount of minutes a cached version of a page or a set of modules can be used before it gets refreshed by Joomla.
The default option is 15 minutes. It is recommended to change this option based on the frequency in which you create new content for your website.
Page Caching in Joomla
The final and all-encompassing option of Joomla Caching is the Page Cache.
With Page Cache enabled, Joomla caches the entirety of each Page. That includes the modules, the article and pretty much everything else. The Cache Settings that you might have selected in the Global Configuration are overridden completely.
How to enable the Page Cache Plugin
To enable Page Cache you must navigate to Extensions > Plugins and type "page cache" in the search box.
Once you find it, click on its name to navigate to its options. Then you will be able to enable it by changing its Status to "Enabled" at the right end of your screen.
Browser Cache
The Page Cache Plugin has another option called "Browser Cache".
If you activate this option, Joomla instructs your visitors browsers that their locally stored snapshots have or haven't been changed on the server and that they can view them immediately instead of the server sending them the same page again.
Of course, in case of a newer snapshot being available, the browser will refresh its own cache.
Exclude Menu Items
After Joomla 3.5 you are able to exclude from the Page Cache some Menu Items which do not want to be cached.
Just click on the textfield and a dropdown select box will appear with all of your menu items to choose from.
Exclude URLs
Finally, an even finer control has been added to the Page Cache Plugin with which you are able to exclude specific URLs or even a range of URLs based on patterns with Regular Expressions.
In our example above we have created 2 patterns (one in each line) with which we exclude all the pages which contain the string "about-" and all the urls which contain the string "/component/users".
Joomla Cache Notes
It is certainly preferable to use caching for your Joomla website whenever it is possible.
Performance is a major factor for your website's success, not only for the fact that it creates a smoother user experience but also for the fact that it helps your ranking in all the major search engines.
Caching Type | View & Module with exceptions* | View & Module with no exceptions* | Full Page Cache |
---|---|---|---|
Conservative Caching | YES | NO | NO |
Progressive Caching | NO | YES | NO |
Page Cache | NO | NO | YES |
* By exception we mean the separate cache setting for each module in their own settings.
If you Joomla website gets updated every once in a while, using the Page Cache is the best option. If, on the other hand, you regularly update your content but instead your modules are pretty much the same then choosing the Progressive Caching is the way to go.
Even when some of your modules get updated you can still use the Conservative Caching to still keep the cache activated for the rest of your modules.
How to Clear Cache in Joomla
Whichever way you choose to cache your Joomla website, it is important to know how to clear your Joomla Cache.
If you liked our extensive guide on Joomla Caching, feel free to sign up to our Newsletter or follow us on Twitter to stay up-to-date on our latest tutorials about your favorite CMS, Joomla!.