DSA Factory
Free Indexes, queries and scale lessonsIndexes, queries and scale · Stage 3 · Scaling out · Step 2

Caching and the CAP trade-off

Cache patterns and their staleness, and what CAP actually forces you to choose when the network splits. About 14 minutes.

Quick check

A product catalogue is read by millions and updated by editors. A cache holds each product page for 60 seconds. What does that choice accept?

  1. AReaders may see a change up to 60 seconds late, in exchange for far fewer database reads
  2. BEdits may be lost
  3. CEvery reader always sees the latest edit
Show the answer

Readers may see a change up to 60 seconds late, in exchange for far fewer database reads. A TTL bounds the staleness.

Lock it in

4 questions on this idea

Short questions that apply the idea to new cases: trace it, work out a number, put steps in order. A wrong answer explains itself.

Answer them in your browserFree account, no card. Your progress is saved, and the idea comes back in a quick review later.
Sign up free to solve