⌘K
Flycodx

Cache-Aside vs Write-Through Caching

Cache-Aside vs Write-Through Caching

MediumBackend0% accepted

Read traffic is hammering your database. Compare caching strategies — cache-aside (lazy), write-through, and write-behind — and pick one for a read-heavy product catalog. Cover: how each handles reads and writes, staleness, the thundering-herd / cache-stampede problem, and a sensible TTL + invalidation strategy.

Approach

Cache-aside: app reads cache, falls back to DB on miss, then populates — simple, possible staleness. Write-through: writes go through cache to DB — consistent, slower writes. Guard against stampedes with locks/TTL jitter.

Scenarios & Expected Answers

No example scenarios for this problem.

Sign in to continue

Create a free account to view answers and mark progress.

  • Free forever — no credit card
  • Theory Q&A with detailed answers
  • Points, streaks & leaderboards
Auto Save On