ProductionIntermediate
Which caching pattern would you use?
“Cache-aside, read-through, write-through, write-behind — how do you choose?”
What this tests
- Caching patterns
- Staleness ownership
Answers by level
Read the beginner answer first and notice what is missing.
Cache-aside is the default: the app reads the cache, loads from the database on a miss, and deletes the key on write. Simple, the cache can fail without downing the app, only read data is cached — the burden is remembering to invalidate on every write path.
Read-through centralises the load logic; write-through gives read-after-write consistency at slower writes; write-behind trades durability for very fast writes.
Green flags · Red flags
Strong green flag · Names the invalidation burden of cache-aside explicitly.
Green flags
- Cache-aside as default
- Knows who owns staleness in each
- delete-over-update on write
Red flags
- "Just add a cache"
- No invalidation plan
Follow-up questions
F1
Why delete rather than update the cache on a write?
Scenario
A product page cache serves stale prices after edits. Which pattern and invalidation would you use?