Some of our members are trying to make their Joomla sites run more quickly. They've seen caching options, which promise to help speed up their sites. But, there are several caching options available.
This blog post explains what options are available and how you can enable them.
This tutorial borrows from this article by Klas Berlič. All of the detailed technical explanations and image are from Klas, so a big thank you to him.
What is a cache?
A cache stores all or part of a web page so that it doesn't have to be pulled from the database. By not needing to connect to the database, a website can respond much more quickly to a visitor.
Does caching help? Yes, absolutely! There are many ways to speed up a Joomla site, but we often see far better results from caching than anything else. As Klas explains in his post, retrieving stored website pages is up to 10 quicker than waiting for them to be created.
Here's a graph shared by one of our members, via Pingdom.com, showing the speed change of their site after enabling the cache.
Option #1: Cache Settings
Go to System > Global Configuration > System. You'll see an area called Cache Settings with these three options:
- OFF - Caching disabled
- ON - Conservative caching
- ON - Progressive caching
Here's the default tooltip explaining the difference between the two ON options.
- Conservative caching: smaller system cache.
- Progressive caching: faster, bigger system cache, includes module renders cache. Not appropriate for extremely large sites.
Let's get a little more specific about the difference between those two:
- Conservative caching: This allows a site administrator to choose which modules are cached. You can login to each module and enable for them individually. Conservative caching is better for frequently updated sites - you can remove caching from your modules that contain dynamic content.
- Progressive caching: This takes a snapshot of each unique set of modules on a page, so many modules can be cached at once. This affects all modules and overrides any cache settings inside individual modules. Progressive caching is better for sites that don't update very often.
This image from Klas shows some of the areas that might be covered by the progressive cache:
Here's an example of a module with cache settings. Notice that there is no "Enable caching" setting. There are only these two choices:
- Use Global: cache this module if Progressive or Conservative caching are enabled.
- No caching: don't cache this module if Conservative caching is enabled.
Option #2: Cache Handler
Inside System > Global Configuration > System, there is a second option called "Cache Handler". This allows to move away from the default setting but this is harder to use. To use anything except the "File" option, you must have appropriate PHP extension installed.
Option #3. Platform Specific Caching
In addition to the other caching options, you'll also get the ability to specific different caches for different device. This allows you to cache one version for desktop users, another for tablet users, and yet another for mobile users:
Here's the description for this setting:
Option #4: Cache Time
Inside System > Global Configuration > System, the third options is Cache Time. The more dynamic your site is, the lower this time should be.
For example, if you leave this setting to 15 minutes, your page will only appear to change every 15 minutes. If your site is updated more frequently, change this to a smaller time. If your site is rarely updated, you can set this to a larger number.
Option #5: Page Cache
To turn on the page cache, go to Extensions > Extension Manager and enable the System - Cache plugin.
In Klas' words, here's what the page cache does:
"Takes snapshots of entire pages including everything - component, modules, plugins and a template. It is the fastest, the widest and the least flexible approach of all caching options."
This image below from Klas shows which areas will be covered by the page cache. In short, the page cache covers the whole page.
Option #6: Browser Cache
To turn on the browser cache, go to Extensions > Extension Manager and edit the System - Cache plugin. Set Use Browser Caching to Yes.
With browser caching, every time someone looks at a page or an image the browser keeps a copy of it. Then if you request that page again within a certain amount of time, rather than run out to the internet to grab a new copy, it just gives you the locally saved version. This make your site feel much faster.