System Design · Building Blocks · Topic 2 of 5
Caching
4 questions.
Your progress0%
- 1st Visit
- 0/4
- 2nd Visit
- 0/4
- Revise
- 0/4
Overview
A cache stores copies of frequently read data in a faster layer, usually memory, so that repeated requests avoid slower databases, disks or remote calls. Caching is one of the most effective ways to cut latency and protect the database in read-heavy systems, but it introduces the risk of serving stale data. This topic covers where caches live, how reads and writes interact with them, eviction policies, and failure modes such as stampedes. Signals that call for caching include a high read-to-write ratio, hot items that many users request, expensive computed results, and latency targets of a few milliseconds. Always state how cached data is invalidated.