Dave, my WordPress site is acting a little wonky, so I updated some plugins and now I’m seeing the message “One or more plugins have been activated or deactivated” with a button to “empty the page cache”. My hunch tells me I should empty the cache … any thoughts?
Is it safe to empty your page cache on your WordPress site because something has changed? Yes. In fact, there’s really no penalty for emptying your cache at any time but to understand why that’s the case we need to step back and talk about how the Internet – and the Web – work. Underlying your cheery pages with graphics and content is a protocol called http, the hypertext transport protocol. https adds security, but in most important ways they’re the same thing.
When you come to a page – say this very page on AskDaveTaylor.com – the basic back and forth between your Web browser and the server somewhere on the Internet that hosts all of my text and graphical elements that comprise this page appears to be this:
In other words, your Web browser asks my server for files, and my server sends them back, allowing your browser to assemble this page. Done deal. Easy. Right?
Well, not quite. When you want to receive all the elements of my Web page, the path that those requests take is more akin to this:
your browser > your ISP > The Internet > my hosting company > my Web server > my file system
for every query. The idea of caching is that at any point along this journey there could be a copy of the file requested that could fulfill the request and save some of the journey / speed up the page load process. This process actually starts within your own Web browser, which is why it’s always faster to explore any page other than the very first page you view on a new Web site: graphical elements common to all pages on a site can be in your Web browser’s cache and those queries can be instantly fulfilled when encountered.
The challenge is to balance out the age of these cached elements versus the performance improvement because you having a copy of my logo for later page loads is great until I change my logo and you’re still seeing the old one two weeks later! That’s why most elements have a cache life of an hour or less, or perhaps as long as a single day. Once every so often a new copy is requested and then that replaces the earlier version.
If you think about billions of these requests going on every day, it’s a brilliant way to speed up the Web.
Which gets us back to your page cache. Here’s the message you likely saw:
As you can see, it says “One or more plugins have been activated or deactivated, please empty the page cache (hide this message)“. Key to remember is that this is on your WordPress server, so it’s actually pretty far down the http request pipeline. Hopefully most of the redundant elements on your page are already cached in the visitor’s Web browser or somewhere else on the path (we’ll get back to that in a minute), but if the request makes it all the way to your Web server, well, that’s where your WordPress cache becomes important.
Install a caching system on your WordPress site – most include one by default! – and it’ll offer that same in-memory speed up buffering of requested elements to help your page load quickly. Generally speaking, though, when you add a new plugin or shut one off, that can affect the elements of your page, including the page itself. As a consequence, WordPress reminds you that something’s changed and that you should empty the page cache.
Always just click on the ’empty the page cache’ button because it’s always safe. Worst case, you slow down page loads for the next few queries as your WordPress server rebuilds its cache so that popular Web pages will load just that tiny bit faster.
While we’re at it, there are a lot of places along the query pipeline that can offer up caches to speed things up. That’s what a content delivery network offers too: A service like Cloudflare, Akamai, Swarmify, Limelight, Microsoft Azure CDN or Amazon CloudFront offer that same caching service but earlier in the request than your WordPress server. Particularly for people visiting your site from overseas, a well distributed network of CDNs can really speed things up and make the entire Web work more efficiently.
So that’s probably more than you wanted to know, but now I hope you really understand how page caching and caching overall on the Web works!