facebooktracking

Many WordPress users are told they need a ‘caching plugin’ and may even have one installed without an understanding of what is going on. It can be difficult to understand even for programmers, so it can be more frustrating when things break as a result of this. This post aims to explain how it all work in English.

There are many kinds of caching but what I want to tell you about today is “page caching”. WordPress plugins like WP Rocket, WP Super Cache and others are the type of plugin that handles page caching.

So: what does caching do?

When you get a visit to your WordPress site, the visitor’s browser communicates with your web server which loads WordPress – this happens via PHP code processing, talking to your database, and then sending the correct files to the browser to be turned into a complete webpage. This can take a few seconds – or what seems like forever to a modern web user.

Page caching delivers a static HTML file to the browser instead of the back and forth above, which is considerably faster.

Now while this is all accurate, it can be hard for the average user to grasp.

Caching – The Big Picture

Imagine you have a very difficult question and it takes a while to get the answer. For instance what kind of fruit is a banana? I see you rushing to Google it, and after a few minutes you will come back to me and tell me a banana is a berry.

Now I ask you again: what kind of fruit is a banana? And instantly you tell me: a berry.

The initial long process of finding the relevant information was done once, then after that, when the same question was asked, the answer was then instantly available, and given much faster.

If applied to the subject of a website, this means the ability to deliver webpages with a very fast response time, without all the time-consuming processing.

The first visitor to a page on your site is asking the difficult question about the banana and your server will eventually provide the answer. The next time a visitor goes to the same page and asks about the ‘banana’, your server can provide the answer, i.e the web page, much faster.

What does this mean for your WordPress site?

A caching plugin provides those fast answers. The plugin basically takes snapshots of all your web pages.
All of the hard work that WordPress does to display the webpage is done the first time a page gets a visit. Once that process has happened the first time, your caching plugin takes the snapshot and when the next visitor comes to your site, it produces the snapshot instead of going through the longer process again.

Static vs. Dynamic

Technically, the snapshot is a static HTML file. This means it won’t change on its own. It will remain the same if it isn’t told to update. 
There isn’t a file stored for every page on your site, because the page is dynamically generated fresh each time it loads – there is no physical file. When you have caching, you will see a cache folder storing all the HTML files. Those files are only changed when the cache is refreshed.

Pin It on Pinterest