Caching keeps a fast copy of data close to whoever needs it. The idea moved from inside the processor to the operating system, the network, shared in-memory stores and finally into code you write, and every step raised new questions about freshness and failure.
1965–1968
Stage 1
CPU caches
The problem
Processors could execute instructions faster than main memory could deliver data, so they spent much of their time waiting for memory.
What came before fell short because
Building all of main memory from the fastest available technology was far too expensive, and expecting every programmer to move data between fast and slow memory by hand was impractical.
What changed
Maurice Wilkes's 1965 paper proposed a small, fast "slave memory" that automatically keeps copies of recently used words from the large, slow main memory. IBM built the idea into a commercial computer, the System/360 Model 85, whose design a 1968 IBM Systems Journal paper described under the name "cache".
Benefits
Most memory accesses were answered at the speed of the small fast memory while the machine kept the capacity of the large slow one, and existing programs ran faster without changes.
New problems it created
Speed now depended on the hit ratio, which changes with each program's access pattern. Designers had to decide what to evict when the cache was full and, in machines with several processors, how to keep the copies consistent.
Where you see it today
Every processor today has several levels of cache. The caching lesson's average-latency calculation (hit share times cache time plus miss share times slow-path time) works for CPU caches exactly as it does for Redis.
Page replacement and the operating system's disk cache
The problem
Disks were far slower than memory, and programs read and wrote the same disk blocks again and again.
What came before fell short because
If every program buffered its own data, the work was duplicated and memory was wasted, and each small read or write still turned into a separate slow disk operation.
What changed
Operating systems took over the job. Virtual-memory systems had to decide which pages to keep in main memory, and Belady's 1966 study at IBM compared replacement policies against an optimal one that knows the future. UNIX, as described in 1974, kept recently used disk blocks in kernel buffers. A read checks the buffers first, writes are collected and sent to disk later, and when a file is read in order the next block is fetched in advance.
Benefits
Every program got faster file access without code changes, and repeated reads of the same data stopped touching the disk at all.
Mid-1990s
Stage 3
Shared web proxy caches: Harvest and Squid
The problem
The early web fetched every page from its origin server, often across slow and expensive long-distance links. The same popular files crossed the same links over and over, and busy servers were overloaded.
What came before fell short because
Each browser kept only its own copies, so a page one person had fetched did nothing for colleagues on the same network.
What changed
Organizations placed shared proxy caches between their users and the internet. CERN's web server could already act as a caching proxy. The Harvest research project at the University of Southern California and the University of Colorado built a much faster cache that could be arranged in a hierarchy, where a cache that misses asks nearby sibling and parent caches before going to the origin. Squid grew out of the Harvest code and is still developed by volunteers.
Benefits
1997–1999
Stage 4
HTTP/1.1 caching rules
The problem
Browser and proxy caches were everywhere, but they had to guess whether a stored response was still correct.
What came before fell short because
Servers had few reliable ways to describe freshness, so caches either served stale pages or avoided caching to be safe and lost much of the benefit.
What changed
HTTP/1.1, first published as RFC 2068 in January 1997 and revised as RFC 2616 in June 1999, added a complete caching model. The Cache-Control header lets a server say how long a response stays fresh (max-age) and who may store it (public, private, no-store). Entity tags (ETag) and conditional requests let a cache ask whether something has changed and receive a short 304 Not Modified reply instead of the whole body.
Benefits
The specification states the goal plainly, which is to avoid sending many requests at all and to avoid sending full responses for many others. Servers could now control freshness explicitly, and browsers, proxies and later CDNs all followed the same rules.
1998–1999
Stage 5
Content delivery networks
The problem
Popular sites slowed down under sudden crowds, and users far from a site's servers waited while every byte crossed congested links between networks.
What came before fell short because
Proxy caches helped only where an internet provider or company chose to run one, site owners could not control them, and one origin still had to absorb every flash crowd.
What changed
After a 1995 challenge from Tim Berners-Lee to find a better way to deliver web content, researchers at MIT worked on algorithms to route and replicate it. Their 1997 consistent-hashing paper was an early result, and the group founded Akamai in August 1998, with commercial service from April 1999. A CDN places caching servers inside many networks close to users and uses DNS to send each user to a nearby edge server. Misses can go through a few well-connected parent clusters instead of straight to the origin.
Benefits
2003
Stage 6
memcached: a shared cache for database-backed sites
The problem
Dynamic, database-backed sites built each page from many queries, and as users grew, the database became the bottleneck.
What came before fell short because
HTTP and CDN caches store whole responses, which does little for pages personalized for each user. The database server's own cache was limited by its memory and by the 32-bit address space of the time, and web processes that cached privately each held duplicate copies.
What changed
Memcached was developed at LiveJournal in 2003 and released as open source. It pools spare memory on many machines into one large in-memory key-value cache. The client hashes each key to choose a server, so every web server finds an item in the same place, and the application checks the cache before querying the database (cache-aside).
Benefits
Database load fell, the cache could grow by adding memory on more machines, and losing one cache server caused only extra misses instead of an outage.
2009
Stage 7
Redis: data structures in memory
The problem
Teams wanted more from an in-memory store than get and set. Counters, queues, leaderboards and sessions needed to change without reading and rewriting whole values.
What came before fell short because
Memcached stores opaque values, so changing one item in a list or bumping a counter inside a value means fetching, modifying and writing it back, with races between concurrent clients.
What changed
Redis began in 2009 as an in-memory store built to speed up a real-time web log analyzer called LLOOGG, and was released as open source that year. It is a data structure server; keys hold strings, lists, sets, sorted sets and hashes, and commands change them in place on the server.
Benefits
One fast, shared store could act as cache, session store, counter service and simple queue, and server-side operations removed many race conditions.
2010–2013
Stage 8
Stampedes, leases and serving stale
The problem
When a popular cache entry expired or was deleted, every request for it missed at once and sent the same expensive query to the database. At very large scale, these stampedes and races between concurrent updates happened constantly.
What came before fell short because
Plain TTLs and delete-on-write invalidation assume misses are rare and spread out. For hot keys they are neither, and a slow rebuild lets thousands of identical requests pile up.
What changed
Two complementary fixes were written down. RFC 5861 (2010) added the stale-while-revalidate and stale-if-error directives, which let an HTTP cache keep serving a slightly old response while it fetches a new one in the background, or while the origin is failing. Facebook's 2013 paper on scaling memcache described leases. On a miss, the cache gives one client a token to refill the key and asks others to wait briefly, which prevents both stale sets and thundering herds. A small spare pool of servers, called Gutter, takes over for failed cache servers.
Benefits
2010s
Stage 9
Programmable caches in the browser and at the edge
The problem
Web apps wanted to work offline or on poor networks and to control exactly what was cached, and sites wanted custom caching logic running close to their users.
What came before fell short because
The browser's HTTP cache follows headers automatically and a page cannot program it, so an app could show nothing without a network. CDN edges applied only fixed rules configured in advance.
What changed
The Service Workers specification, developed at the W3C, lets a site install a script that intercepts its own network requests and can answer them from a programmable request-and-response store (the Cache API), even offline. CDNs then let customers run small programs on their edge servers. Cloudflare's 2017 Workers announcement deliberately reused the service-worker programming model, so similar code could decide what to cache at the edge.
Benefits
New problems it created
With delayed writes, data a program believes is saved may still sit only in memory when the machine crashes. The cache also competes with programs for the same memory, and a policy that keeps recently used data does badly when one large, one-off scan pushes out everything useful.
Where you see it today
Operating systems still keep recently used file data in otherwise free memory, and databases keep their own buffer pool of pages. LRU and its relatives, which the caching lesson covers under eviction, come from this line of work.
One download could serve many users, cutting bandwidth and waiting time, and the Harvest team measured that the hierarchy did not noticeably increase latency.
New problems it created
Servers had no standard way to say how long a page stayed valid or that it must not be cached, so caches guessed. Harvest gave objects default lifetimes and could return stale data, and pages that changed on every request were hard to handle safely.
Where you see it today
Squid is still maintained and used as a caching proxy, and the idea of asking a nearby cache before the origin lives on in the edge and parent tiers of today's CDNs.
A response cannot be recalled once it has been cached with a long lifetime, so teams began putting a version in file names to force fresh downloads (cache busting). Wrong headers can show stale pages or, worse, let a shared cache serve one user's private page to someone else.
Where you see it today
The rules now live in RFC 9111 (2022). Your browser applies them on every page load, and the caching lesson's real-world section starts with the browser cache following Cache-Control.
Most requests are answered near the user, so pages load faster and the origin is shielded from crowds. Akamai's 2010 paper reports that tiered caching typically offloads well over 90% of requests for customers with very large content libraries.
New problems it created
Content now lives in hundreds of places, so updating or purging it quickly is hard. Personalized or fast-changing pages gain little from edge caching, and the site's availability now depends on a third party.
Where you see it today
Most large websites deliver images, scripts and video through a CDN. In the caching lesson's request diagram, the CDN edge is the first layer after your browser.
The application now had to keep the cache in step with the database by updating or deleting keys on every write. With simple modulo hashing, adding or removing a cache server moved most keys and caused a wave of misses.
Where you see it today
Memcached is still widely used and is offered as a managed cloud service. The caching lesson's cache-aside experiment models exactly this pattern.
Because Redis was so convenient, teams kept data in it that existed nowhere else, so a lost or evicted key was no longer a harmless miss. A busy instance also runs commands essentially one at a time, so one slow command delays every client.
Where you see it today
Redis and Valkey, the open-source fork started under the Linux Foundation in 2024 after Redis changed its license, are common shared caches today. The caching lesson's diagrams place one between the app servers and the database.
A hot key is rebuilt once instead of thousands of times, users get fast responses during refreshes and short outages, and the database is protected from sudden bursts of identical queries.
New problems it created
Serving stale data is a deliberate trade-off that must be acceptable for each kind of data, and coordination such as leases adds state and extra round trips to the cache protocol.
Where you see it today
HTTP caches and CDNs support stale-while-revalidate, and caching libraries offer request coalescing and early refresh. The caching lesson's stampede experiment lets you turn on coalescing and TTL jitter and watch the database spikes disappear.
Apps can load instantly from local copies and keep working offline. Caching decisions, such as normalizing URLs to raise the hit rate, can be written as code that runs close to the user.
New problems it created
Caching logic is now code that can have bugs. A faulty service worker can keep serving an old version of a site until it is replaced, and logic spread across browser, edge and origin is harder to reason about and test.
Where you see it today
Progressive web apps use service workers for offline support, and most CDNs offer edge functions. Together with the browser cache, they form the outer layers of the caching lesson's "one request, five places to find a copy" diagram.