How do read-through, write-through, write-back and write-around differ?
Short answer
Read-through: the cache loads from the DB itself on a miss. Write-through: write cache and DB synchronously. Write-back: write only the cache, the DB is updated in batches later. Write-around: write straight to the DB, skipping the cache.
3 points to say:
- Write-through writes both synchronously: the cache is always fresh but write latency is high; write-around skips the cache, so a read right after the write misses.
- Write-back batches writes (like/view counters, analytics) but can lose data if the cache dies before it flushes.
- With Redis the default is cache-aside; choose by read/write ratio and how much data loss you can tolerate.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.