🧠Knowledge Series #22: What’s a cache?
Your ultimate guide to how a cache works and why caching is critical
🔒The Knowledge Series is a collection of easy to read guides designed to help you plug the gaps in your tech knowledge so that you feel more confident when chatting to colleagues. Clearly explained in plain English. One topic at a time.
If you’re a free subscriber and you’d like to upgrade to unlock them you can do so below. Or you can find out more about paid access here.
Hi product people 👋,
You’ve probably heard engineering and devops teams refer to caching and you may have been advised to clear your cookies and cache in an attempt to fix a bug. But unless you’ve had to work as an engineer yourself, that’s likely to be the extent to which you’ve had to interact with caches.
They’re a fairly niche topic but smart use of caching can have a significant positive impact on the performance of your product and so in this Knowledge Series we’re going to explore what caches are, where they fit into the overall tech stack and some of the important, practical benefits they can have on your product using examples from GitHub and Twilio to help.
Coming up:
What’s a cache? The important bits worth knowing
Where does caching fit into the overall tech stack?
The differences between caching, cookies and local storage
Practical product use cases and benefits of caching: examples from GitHub and Twilio
How to see your own cache working in real time
What’s a cache?
Caching is the process of storing things closer to whoever or whatever is using them so that those things load faster.Â
As we’ve previously discussed in other editions of the Knowledge Series, whenever you load a page on a website or an app, your client is requesting files from the server. This server can be physically located far away from you and so this process can take a little while.
Engineers will make smart use of caches to ensure that the pages you visit will load faster.
To use a food and restaurant analogy, think of a cache as a smart pantry which contains all of the important ingredients that you use all of the time like salt, pepper, olive oil. Instead of keeping these frequently used items locked away in a cupboard with everything else, you have a small shelf right next to your stove where you keep these essentials. This shelf is like a cache in a computer.
When you're cooking (or the computer is running a program), you want to work as efficiently as possible. If you had to walk to the pantry every time you needed salt, it would slow down your cooking significantly. Similarly, a computer stores data or instructions it uses frequently in a cache to avoid the time-consuming task of fetching them from the main storage (the pantry in this case) every time.
Where does caching fit into the overall tech stack?
There are a bunch of different types of caches that are used and they can be deployed across various parts of a tech stack including the CPU, hard disk, network and more.Â
But in the context of product development, we’re broadly concerned with two types of caching:
Client side caching in the browser
Server side caching on the server