What Is Caching and Why It Exists
A cache is a fast storage layer that holds copies of data so future requests can be served without repeating expensive work. Every time your app queries a database, calls an external API, or recomputes a result, it spends time and money. Caching trades memory for speed — store the answer once, reuse it many times.
Caching solves three problems at once. Latency drops because reading from RAM is orders of magnitude faster than hitting a database over the network. Cost falls because fewer database queries mean smaller instance sizes and lower cloud bills. Load on downstream systems shrinks — your database handles 10x more traffic when 90% of reads never reach it.
The two outcomes every cache produces are a hit and a miss. A cache hit means the requested data was found in the cache — fast path. A cache miss means it was not — the system must fetch from the source, store the result, and return it. Hit ratio (hits / total requests) is the single most important metric: a 95% hit ratio means only 1 in 20 requests touches the slow path.
Check your understanding
What is hit ratio?Show answerHide answer
Answer
hits / total lookups — the primary health signal for whether the cache is earning its keep.What happens on a miss?Show answerHide answer
Answer
Load from the source of truth, optionally populate the cache, then return the value.Name three reasons caches exist.Show answerHide answer
Answer
Lower latency, lower cost/load on backends, and absorbing read spikes — for the cached subset of traffic.