01Chapter 1: What a cache is and when it pays offThis chapter assumes you can read basic Python, and that you know how a client sends a request to a server and how a server reads from a database. It also assumes you understand latency (the time one request takes) and throughput (how many requests a system handles per second). No caching experience6 min read
02Chapter 2: The layers where caching happensA request for data often passes through several caches before it reaches the original source. This chapter maps those layers, explains what each one is good at, and describes the errors that appear when layers interact. It assumes you know basic Python, how client-server requests and databases work,6 min read
03Chapter 3: Designing cache keysA cache key is the identifier a cache uses to find a stored value. A bad key causes wrong answers, not just slow ones. If two different requests share a key, one user gets another's data. If one logical request maps to many keys, the hit ratio drops and memory fills with duplicates.6 min read
04Chapter 4: Cache-aside: the default read patternThis chapter assumes you can read basic Python and know how a client, a server, and a database exchange requests. It also assumes you know what a cache hit and a cache miss are, and that you understand latency, the time one request takes. Cache keys are covered in the previous chapter. Here, keys ar6 min read
05Chapter 5: Read-through cachingThis chapter assumes you know cache-aside, hit ratio, and TTL from the earlier chapters. It also assumes you can read basic Python and know how threads share data. Read-through caching uses the same lookup logic as cache-aside. The difference is where that logic lives.5 min read
06Chapter 6: Write-through cachingThis chapter assumes you know basic Python, how an application talks to a database, and the cache-aside pattern from the earlier chapters. Here you will see how write-through keeps a cache and a database in step on every write. You will also see what it costs and where it breaks.5 min read
07Chapter 7: Write-around cachingWrite-around caching sends writes straight to the database and skips the cache. Reads still go through the cache, which fills on a miss. This chapter assumes you know cache-aside (read path with a miss and fill), what a hit ratio is, and what TTL means.5 min read
08Chapter 8: Write-back cachingThis chapter assumes you know the cache-aside and write-through patterns from earlier chapters, and that you are comfortable reading Python with threads. Write-back caching (also called write-behind) trades durability for write speed. You will see how it works, how to build a small version, and wher4 min read
09Chapter 9: Expiring entries with TTLThis chapter assumes you know what a cache is, how cache-aside works, and how to read basic Python. It covers how a time to live (TTL) works, how to choose one, and the errors that appear most often in practice.5 min read
10Chapter 10: Eviction policies: LRU, LFU, and FIFOA cache has a fixed capacity. When it is full and a new entry arrives, the cache must remove something. The rule that picks the victim is the eviction policy. This chapter assumes you know what a hit and a miss are, and that you have seen the cache-aside pattern and TTL expiration from earlier chapt6 min read
11Chapter 11: Invalidating cached dataThis chapter assumes you know what cache-aside is, how TTL expiration works, and how to read basic Python. Invalidation is the act of removing or replacing a cached entry because the source data changed. It is the hardest part of caching to get right, because the cache and the database are two separ5 min read
12Chapter 12: Consistency and staleness trade-offsThis chapter assumes you know the cache-aside pattern, TTL expiration, and invalidation from earlier chapters. You should also be comfortable with client-server requests and with basic database behavior. Here we look at what a cache costs you in correctness, and how to decide how much staleness is a7 min read
13Chapter 13: Preventing cache stampedesThis chapter assumes you know cache-aside reads, TTL expiration, and basic threading in Python. A cache stampede happens when many requests miss the same key at once and all of them go to the source to rebuild it. Cache-aside makes this easy to trigger, because every miss triggers a load.6 min read
14Chapter 14: HTTP caching and validationHTTP caching lets browsers, CDNs, and proxies reuse responses without asking your application again. This chapter assumes you know the cache-aside pattern, TTL expiration, and basic client-server requests. The goal is to read and set the headers that control freshness and revalidation.5 min read
15Chapter 15: Distributed caches and consistent hashingThis chapter assumes you know the basics from earlier chapters: hit ratio, cache-aside, TTL, and eviction policies such as LRU. It also assumes you are comfortable with client-server requests and with Python. Here you will learn how a cache spreads across several machines, why a naive scheme for cho6 min read
16Chapter 16: Measuring cache effectivenessThis chapter assumes you know basic Python, how a client talks to a server and a database, and the difference between latency and throughput. It also assumes you have met the cache patterns and eviction policies from earlier chapters. Here you will learn which numbers show whether a cache helps, how6 min read
17Chapter 17: Choosing a strategy for your workloadThis chapter assumes you know the patterns from earlier chapters: cache-aside, read-through, write-through, write-around and write-back. It also assumes you know TTL, eviction, invalidation and stampedes. Here you combine them. The goal is a repeatable way to pick a design, instead of a favorite pat5 min read