Technology · July 20, 2023 · Liam Chen · 6 min
A cache is a temporary store of data kept close at hand so it can be reused quickly. Here is how caching works, where you meet it every day, and why clearing it sometimes fixes things.
You have almost certainly been told to "clear your cache" when a website misbehaves. It is one of the most common pieces of tech advice, yet the cache itself is rarely explained. Once you understand the idea, a lot of everyday computing makes more sense.
Here is what a cache is and why it matters.
A cache is a temporary store of data kept close to where it is needed, so the same data can be reused quickly instead of being fetched or calculated all over again.
The principle is simple: the first time your device needs something, it does the slow work of getting it. It then keeps a copy nearby. The next time the same thing is needed, it uses the saved copy, which is far faster. Caching trades a little storage space for a lot of speed.
The word is pronounced cash. It comes from the French cacher, meaning to hide, because the stored data sits quietly in the background until it is needed.
Think of a chef in a busy kitchen. Rather than walking to the pantry for an ingredient every single time, the chef keeps the most-used items on the worktop within arm's reach. Fetching them becomes almost instant.
The worktop is a cache. It is small, so it cannot hold everything, but it holds the things used most often. The pantry still has the full stock; the worktop just keeps a handy copy of the popular items. That is exactly how a cache behaves in computing.
Caching is happening constantly, usually without you noticing. A few common examples:
In every case the goal is the same: avoid repeating slow work by keeping a copy of the result nearby.
Caching is one of the most important tricks in all of computing because it tackles a basic problem: some things are slow. Reading from a distant server, fetching from a hard drive or recalculating a complex result all take time. A cache hides that cost by reusing earlier work.
The benefits stack up:
Without caching, the web would feel sluggish, mobile data would vanish far quicker, and servers everywhere would be under far more strain.
Caching has one fundamental drawback. A saved copy can fall out of date with the original. This is called stale data.
Imagine a news site updates its front page, but your browser is still showing the version it cached an hour ago. The copy is fast, but it is wrong. This tension is so well known that programmers joke that one of the two hardest problems in computing is deciding when to throw cached data away.
A cache is only useful while its copy still matches reality. The art of caching is knowing when to trust the copy and when to fetch a fresh one.
To manage this, systems set rules about how long cached items stay valid. Web servers can tell your browser "this image is good for a week" or "always check with me before reusing this page." When the time is up, or the rules demand it, the cache fetches a fresh copy.
Now the famous advice makes sense. When a website looks broken, shows an old version, or refuses to log you in properly, the cause is often a stale or corrupted cached file. Your browser is faithfully reusing a saved copy that no longer matches what the site expects.
Clearing the cache deletes those saved copies. The next time you visit, your browser has no choice but to download everything fresh, which usually replaces the bad files with correct ones and fixes the problem.
The trade-off is small and temporary: the next page load is a little slower while new copies are fetched and the cache fills up again. It is also worth knowing what you are clearing. The cache holds page files, images and scripts. Your saved passwords, cookies and browsing history are stored separately, and most browsers let you tick exactly which items to remove. So you can clear the cache without losing your logins.
If you would rather not wipe everything, many browsers offer a "hard refresh" that reloads the current page while ignoring its cache, often by holding a key while clicking refresh.
It helps to separate a cache from permanent storage. A cache is meant to be temporary and disposable. If you delete it, nothing important is lost, because the originals still exist elsewhere and can be fetched again. That is the whole point: a cache is a convenience copy, not the master record.
This is why deleting a cache is generally safe, while deleting your actual files or documents is not. The cache is built to be thrown away and rebuilt whenever needed.
A cache is a temporary store of data kept close at hand so it can be reused quickly, sparing your device or a server the slow work of fetching or calculating it again. It powers the speed of browsers, apps, processors and the wider web, quietly saving time and reducing network traffic.
Its one weakness is staleness: a saved copy can drift out of date with the original. That is why clearing your cache, which forces fresh copies to download, so often fixes a misbehaving site. Understand that balance between speed and freshness, and the cache stops being mysterious and starts being one of the most useful ideas in computing.