It’s probably just cached

Wednesday, July 22, 2020 • Website Design and Development • 3 minute reading time

This article is part of a series discussing How to handle more traffic to your website.

If you’re someone who’s worked with a web developer or web designer before, you’ve probably been told it’s a cache problem. If this is you, you probably know how to clear your cache by now. It’s entirely possible though that you don’t know what on earth your cache is, or why you’d ever need to clear it!

What is a cache?

There’s a lot of different kinds of caching involved with web servers and browsers – some or all of which may be relevant to your website. Simply put, a cache is a store of files that can be used to speed up repeat operations.

Browser caching

When a web browser visits a website, the assets of that website are written to disk so they can be used again. You’ll likely notice the first time you load a website, it may take a little while, but on subsequent visits or visiting different pages it seems much quicker. This is usually because the browser has saved downloaded stylesheets, fonts and javascript to your computer or mobile device.

Simply put, a cache is a store of files that can be used to speed up repeat operations.

Depending on a site’s configuration and the frequency of changes, your cache may last a long time – this sometimes causes problems when working on new content, features or functionality for your website as you don’t see the new changes instantly; this is a good time to clear your cache or use a private window; private windows don’t generally share a cache with non-private sessions.

Server caching

Modern websites are complex. When you request a page from a dynamic website – such as one built on WordPress – the server has to compile the page. This can take many database queries, calls to external systems, running scripts…and many other steps! Gone are the days of serving up some nice straightforward HTML – well mostly, but that’s another topic for another day.

We employ server side caching to generate compiled copies of these dynamic pages for users of the website to download, so the same set of operations aren’t ran for each and every site visitor. This can either be done on-the-fly – when a user visits the site, a copy is stored for a pre-defined amount of time for any subsequent users or it can be preloaded, so that the page is immediately available for the next user that visits.

Server-side caching can greatly help when you’re getting a lot of traffic to your site at one time – it’s much easier for a web server to deliver a pre-compiled page to browsers than generating that page time and again for every single user.

DNS Caching

A website lives on a web server, and each web server has an IP address – this uniquely identifies a server on the web. When you buy a new domain name, you point this at an IP address.

Then, rather than your visitors needing to type a confusing series of numbers into their browser, they can just visit yourdomain.com – the browser asks your operating system where the domain is pointing to and brings the page to your browser.

Doing this for every request would be time consuming, and as websites don’t move around that often it makes little sense to make the same request again and again. So, your operating system – or office server, or Internet Service Provider – caches this result so it’s readily available.

This is great, until your shiny new website goes live and you can’t see it because you’re being sent to the old address! Generally after a few hours you’ll be sent to the right place and everything is grand. There’s things you can do to mitigate this problem.

Summary

There’s a lot more to each of these types of caching but hopefully this gives you a good overview of what someone is talking about the next time you hear them say “it’s probably just cached”.

Richard Keys

Rich is Genius Division's technical director. When he's not building Lego or painting toy soldiers he's probably having fun with his kids. Lover of mountains and reading: Stephen King and Middle-earth are among his favourites.