Code RoomStale-while-error caching
MediumPrep Room Coding #3189

Stale-while-error caching

System designDistributed systemsMid–Senior~35 min

Design the TTL and revalidation strategy for an API response cache in front of a slow, occasionally-flaky upstream (a 300ms third-party API that sometimes errors or times out). You want most responses served instantly from cache, freshness within ~60s, and — importantly — you'd rather serve slightly stale data than show users an error when the upstream is down. Design the caching/revalidation behavior to balance freshness, latency, and resilience.

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts (data model, bottlenecks, consistency, failure modes) and name the trade-offs you are making.

Clarify4:00 left
Estimate4:00 planned
Design11:30 planned
Deep dive9:30 planned
Failure6:00 planned
0:00
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.