System Design
7. Caching ArchitectureAnimated
In-Memory Caching
Storing data in RAM for very fast access.
The idea
RAM is orders of magnitude faster than disk. In-memory stores hold hot data.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- hit
- current request
A is missing: fetch it from the database and store it.
- step:
- 1
- hits:
- 0
1/22
Eviction policy: least recently used.
Step by step
- 1Keep hot data in RAM
- 2Serve reads from memory
- 3Evict when full
- 4Persist optionally
Where it is used
Sessions, leaderboards, counters.
Watch out for
RAM is expensive and volatile.