Caching Patterns
TTL, event-driven, and manual invalidation to manage cache freshness
Control staleness by expiring, versioning, or actively invalidating cached data. Use TTL with jitter, event-driven invalidation, and versioned keys to balance freshness and performance.
When correctness matters with cached data, or you operate multiple cache layers and need predictable freshness.
Feeds, product catalogs, and dashboards requiring fresh-but-fast reads.
# Invalidation flow (pseudocode)
db.update(row)
eventBus.publish({ type: 'invalidate', key })
worker.on('invalidate', key => cache.delete(key))
TAO graph cache invalidation at scale
Billions of entitiesEvent-driven invalidation of hot pages
Hundreds of millions of usersVersioned cache keys for releases
Large commerce catalogsHorizontal - Distributed caches
High - Hardest problem in CS
Medium - Infra + engineering time