Dynamic website caching is one of the bedrocks of any modern website. Even if you have low traffic, caching can help you deliver your content faster to users, reducing the bounce rate, increasing your conversions, and even score points with search engines. With Google’s Lighthouse initiative, it now collects data on average load speeds of websites using various metrics, so expect this factor to gain even more prominence in the coming years.
However, it’s easy to go overboard with caching, especially since many WordPress plugins don’t check whether or not you already have it enabled elsewhere. Here are the various caching mechanisms you can have:
- Server-based caching (via NGINX or LiteSpeed for example)
- Plugin based caching (W3 Total Cache, WP Super Cache, PageSpeed Ninja etc)
- CDN caching (mostly static files, but can also be dynamic)
Here are a few ground rules on what types of caching to have, and it what order.
Rule 1: Server Website Caching > Plugin Caching
If you’re lucky enough to have a web host or a plan that provides server-based caching, use it! In fact, make sure you choose it over plugin-based caching and disable the latter.
For example, all NameHero sites have access to server caching because we use LiteSpeed as our server instead of the traditional Apache. This means that your site doesn’t have to do the hard work of storing and serving cached pages. Instead, the heavy lifting is done by your server.
In setups like NGINX, the caching server sits between your website and the outside world. And this server intercepts requests and processes them. Ideally, your website is not even aware of the NGINX server. As a result, there’s no additional load, and you don’t use up any extra resources like CPU time and script execution quotas.
However, if you don’t have server-based caching, you might be forced to use plugins instead. There are quite a lot of good ones out there and they all have their strengths. Some of them have more options than others, and some do a lot more than just cache your site. They can also combine and minify your CSS, defer your scripts, and a lot more!
Rule 2: Use Only ONE Caching Plugin – Or Use ONLY Server Caching
Using more than one caching plugin is completely counterproductive. They’ll essentially be competing with each other. But if you have access to server-based caching, make sure you use only that, and nothing else.
Another downside of using multiple caching plugins is that it’s a pain to make and test changes to your site. For some reason, your site won’t show the updates and then you’ll have to see which plugin is serving the outdated version, and why.
Rule 3: Have Separate Plugins for Caching and Optimization
But experience has shown me that it’s better to have separate decentralized plugins that perform individual tasks. Because if something goes wrong with the one plugin, everything on your site comes down. Not only that, you lose the freedom to switch between plugins and become averse to testing out new things.
It’s a good rule of software design in general – beware of overarching tools. Have small, dedicated pieces of software for each functionality.
CDNs are Ok – They Don’t Really Count
Since CDNs mostly server static files and store them at EDGE locations, they’re exempt from the above rules. Except when you use something like Cloudflare’s “Cache Everything” page rules – not a good idea in general.
But you do need to remember that it’s another caching layer, and that if you’re not seeing the changes on your site that you want, it could be because your CDN is playing tricks. Luckily, something like Cloudflare has an easy “Development Mode” that you can turn on temporarily.
It’s easy to go overboard with caching. But if you follow these few simple rules, you should be fine!
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!