5.1.1 Caching
A cache holds a copy of data closer to the reader: in process, Redis, or a CDN. You trade freshness for speed and lower origin load.
Why it matters
Databases and model calls are slow and expensive. A high hit rate can cut latency and cost by an order of magnitude.
How it is used
Cache by a key that includes everything that changes the result. Set a TTL. Decide what happens on miss (stampede): single-flight or lock. Never cache personalized or secret data on a shared public cache.