Skip to content
lesson Search and website performance Beginner 3 min read

What is website caching?

A cache keeps a copy of your web pages so they load faster. Where the copies live, why an edit sometimes does not show, and how to clear them.

A cache is a stored copy of something a website has already sent out, kept so that the next request can be answered from the copy. Reusing a copy is faster than building the page again, and it gives the web server less work to do. A business website can be cached in three places at once.

Where the copies are kept

  • The browser cache is on the visitor’s own phone or computer. It serves one person, and it mostly holds files that rarely change, such as images, style sheets and scripts.
  • The server cache, often called a page cache, sits with the website. On a WordPress site it saves finished posts and pages as plain files and hands those to visitors, which takes processing load off the server.
  • A CDN cache belongs to a content delivery network: a network of servers placed closer to visitors than your own server is. The first time a file is requested, the CDN fetches it from your server and keeps a copy for whoever asks next.

The last two are shared caches, where one stored copy is reused for many visitors. Pages that differ from person to person, such as a shopping cart or an account page, have to be kept out of them. A personal page stored in a shared cache can be shown to somebody else.

Why a change sometimes does not show

Every copy has a lifetime. The website tells each cache how many seconds a copy may be reused. Until that time is up the copy counts as fresh, and it is handed out without asking the server. After that it is stale, and the cache asks the server whether anything has changed before using it again.

So you can correct a price, save it, and still see the old one. The edit was saved. You are looking at a copy that has not expired yet, and it may be in the browser, on the server or at the CDN.

How a cache is cleared

  1. Reload the page. An ordinary reload makes the browser check with the server before it reuses its copy. A forced reload asks for a complete new copy.
  2. Clear the server cache. Whoever manages the site can delete its stored pages at any time, usually from a settings screen.
  3. Purge the CDN. Purging removes a file from the CDN’s servers before it would have expired, usually through the CDN’s dashboard.
  4. Look again on a different device, to see what a new visitor sees.

A long-lived copy in a visitor’s browser is hard to take back, because the browser does not ask the server again until the copy expires. Developers get around this for images, style sheets and scripts by putting a version number in the file name. A changed file then has a new address, the old copy is never asked for, and these files can safely be kept for a long time.

What to ask about your own site

  • Which of the three caches does the site use, and who can clear each one?
  • How long are pages kept before they are refreshed?
  • Are the cart, checkout and account pages kept out of the shared caches?

Caching is one of the things that decides how quickly a site loads. How that speed is measured is covered in Core Web Vitals, explained. To have the caching on your site set up or checked, see Websites and Optimisation.

Sources

  1. HTTP caching (MDN Web Docs, Mozilla) developer.mozilla.org
  2. RFC 9111: HTTP Caching (IETF) rfc-editor.org
  3. Content delivery networks (web.dev) web.dev
  4. Cache: Advanced Administration Handbook (WordPress.org) developer.wordpress.org

Written by Only Tech Solutions.

This is general information, not advice for your situation. See the terms and conditions.

We can sort this for you

More lessons

All lessons

Tell us what needs sorting.

Book a call or send an email. We reply within one business day.