Cache-aside, write-through, write-behind — different shapes, different tradeoffs.
Cache Patterns: cache-aside, write-through, write-behind
absorb bursts before they become outages
DEL vs SET on write — DEL is safer; SET avoids miss.
Cache-aside is the most common: app reads cache, falls through to DB on miss, populates cache. Write-through writes via cache to DB. Write-behind queues writes for later.
Cache-aside is robust to cache failure but invites stale reads after writes.
Write-through synchronizes cache and DB but slows writes.
Write-behind risks data loss on crash; reserve for non-critical paths.
Cache user profile.