Caching is a complex technology that does one simple thing really well: it makes your website really fast. And speed is critical to the success of your site because people don’t like waiting around for web pages to load. In fact, a study by CDN service Akamai found that 47% of people expect a web page to load in 2 seconds or less, and 40% will abandon a page that takes more than 3 seconds to load.
So you’d think that in response websites are shrinking in file size, right? Not so. Today’s average web page requires users to download 2.2MB worth of data compared to just 702KB in 2010. That’s a 317% increase in size thanks to things like images, videos, scripts and fonts.
Fortunately, installing a caching plugin can load your site faster – extra files and all. In this article, I’ll cover what caching is and explain the different kinds of caching, but mostly focus on caching plugins and why you need to install one ASAP if you haven’t already.
What is Caching?
Caching is the process of storing frequently-accessed data temporarily in a cache. To explain it properly, let’s first look at what happens when you don’t use caching:
When someone visits a page on your site, they need to request information from your web host. These requests include files such as HTML and PHP files, scripts, images, and fonts. In addition to this, the user also needs to retrieve content that’s stored in your WordPress database, e.g. posts and pages.
Essentially, this is what happens:
- A visitor lands on your website and their browser contact your web server
- Your WordPress install retrieves information such as your posts and other data from your database
- The web server then compiles this data into an HTML page and serves it to the visitor.
A simple representation of how data flows between visitors and your website.
Since WordPress generates content dynamically, this means that it requests fresh information about a web page each and every time a visitor views a page. While this ensures visitors see up-to-date information on our website, it also means visitors have to wait longer for your web pages to load.
This is precisely why caching plugins were created.
How Caching Plugins Work
Usually, the pages and posts on your site won’t change much once published unless you redesign your site or update content. So what a caching plugin does is create a static version of your web page that it delivers to your visitors. This means that when a visitor returns to your site to view it again, they will see a cached version.
I like this analogy from the Sideways Dictionary:
It’s like your fridge. You don’t go to the store to buy milk for your coffee, go back later for some butter for your toast, then go back for some milk for your cereal. Your fridge is the cache and your store is the web server.
The beauty of WordPress caching is that it occurs without the visitor even knowing about it. It minimizes the amount of data that is transmitted between the visitor’s browser, the WordPress database, and the web server, which translates into faster loading times.
What Happens When You Update a Web Page?
You might be thinking that when you update content on your site, it won’t load for returning visitors? Not so. Caching plugins have a mechanism to empty the cache and then regenerate it with updated content when specific conditions are met, i.e. you publish a new post.
Say you update the CTA in the header on your homepage but touch nothing else on your site. A caching plugin would delete the cached version of your homepage and save a new version, but wouldn’t touch the rest of the pages on your site since they haven’t been changed.
Types of Caching
There are two primary types of caching: client-side and server-side.
Websites have a lot of static data such as images, stylesheets, and scripts. Client-side caching, also known as browser caching, allows your browser to store this static content so it doesn’t need to download them every time you visit a site. They are simply served from a local cache stored on your computer’s hard drive.
For example, the first time you visit this site, WP Rocket, your browser will download all the files it needs to display this page and immediately cache it. The next time you visit, the page will load much faster.
There are various types of caching associated with server-side caching that is used for WordPress caching, which you can control with plugins like WP Rocket, including:
- Page caching: This is the simplest of the caching protocols. It’s the process of saving dynamically generated web pages on the server’s hard disk and serving them from the cache every time a request is made.
- Mobile caching: Similar to page caching, mobile caching creates a dedicated cache file for mobile devices for every document that gets cached. This means visitors who return to your site using their mobile will be able to access your web pages faster.
- User caching: This type of caching creates a dedicated set of cache files for each logged-in WordPress user. This means your site will be cached as normal for visitors and a separate set of cache files will be stored for each person who logs in to your site.
- Database query caching: This type of caching allows you to cache the result of a single query to your database and store it on your web server until you publish a new post, update an existing post, or change your WordPress settings.
- Object-based caching: WordPress has its own internal caching system that includes several subsystems such as the Caching API, Object Cache, and Transient API. This caching system can be controlled by caching plugins to reduce the number of database calls.
- Opcode caching: All PHP pages on a WordPress site must be compiled into code that a device accessing a web page can execute. Opcode caching saves this compiled code between requests, which means less compilation, and in turn less work for the server and faster server response times.
Why You Need a Plugin to Control Caching
Without any caching at all, visitors to your website would have to download your web pages every single time they visit your site. But thanks to modern browsers, browser caching ensures users returning to visit your web pages will be able to access your content faster.
A caching plugin allows you to take all of this a step further by removing many of the steps that take place when WordPress generates a page dynamically.
Such web performance features are essential to boost your Core Web Vitals metrics and your PageSpeed score. Your SEO performance will definitely benefit it, too!
Top 3 Caching Plugins for WordPress
The three most popular caching plugins for WordPress are:
- WP Rocket
- W3 Total Cache
- WP Super Cache
Each of these plugins is highly regarded in the WordPress community and come with their own distinct feature set.
Caching plugins all work differently depending on a number of factors, including the type of hosting plan you’re with, whether your server has been configured correctly, and how much content is on our website, etc.
So in order to determine the best caching plugin for your website, I recommend testing the speed of your site with a tool like Google PageSpeed Insights, GTmetrix, or Pingdom to benchmark your site speed. Then install the plugins you are considering and activate them one at a time, configure settings as needed, and run your site through the testing tools again, taking note of the results.
If you would rather just skip ahead, I highly recommended these two excellent benchmarking articles. Each provides a detailed comparison of the top three plugins:
- Benchmarking the Fastest WordPress Cache Plugins
- The 9 Best WordPress Caching Plugins Tested and Compared
WP Rocket is ranked the fastest caching plugin for WordPress in the two above-mentioned reviews. It outperformed the others in terms of speed and ease of use.
It’s worth mentioning a very important rule of thumb when using a caching plugin: you only need one. Installing more than one won’t make your site any faster. In fact, it’s more likely to make your site slower and even break it.
Ready to Install a Caching Plugin?
Site speed plays a critical role in the success of your site, so if you’re not already using a caching plugin, now’s the time to install one. It’s the way to go to optimize metrics such as the Largest Contentful Paint and the First Input Delay.
To get started using one, take a look at the plugins mentioned above, read more reviews, do your research, and set one up on your site. Don’t forget to benchmark your site speed so you can measure the results. Only then will you be able to determine which caching plugin works best with your setup.