Caching can deliver an immediate performance improvement while introducing problems that appear later. Suppose a bookstore caches popular book records and sharply reduces database traffic. A subsequent catalog update might appear on one API instance but not another. During a cache restart, every instance could send its misses to the database at once, overwhelming a system that normally handles only a small fraction of the traffic.
Caching improves performance by reusing results, but it also introduces another copy of data and another operating mode.
This chapter explains where to cache, how to identify reusable results, how to manage freshness and invalidation, and how to remain predictable when cached data or the cache itself is unavailable. The examples use a fictional bookstore; policies and numerical limits are application choices.