intermediateTop 30 Scenario-Based Questions
How do you handle cache invalidation when multiple services can update the same data?
Cache invalidation is the hardest problem. Strategies: 1) Event-driven invalidation: when any service updates product, publish ProductUpdated event to message bus (Kafka). All services subscribed delete their cached product version. 2) TTL-based staleness: accept up to 5-minute stale data. Set TTL=300. Auto-expired even if event missed. 3) Cache versioning: store version with cached object. On upd
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.
How do you handle cache invalidation when multiple services can update the same data?