Caching and Messaging for System Designs
Caching and messaging are two tools for speed and decoupling. A cache such as Redis keeps hot data in memory with strategies like cache-aside and write-through, and eviction policies like LRU. Queues and streams, such as Kafka or RabbitMQ, move work asynchronously between services and absorb traffic spikes.
Stage: Data at Scale · Part of the System Design roadmap · Last reviewed 19 November 2026
What to learn in Caching and Messaging
- Implement cache-aside and explain how stale data appears
- Pick an eviction policy such as LRU or TTL-based expiry
- Describe cache stampede and ways to prevent it
- Compare a message queue with a log-based stream
- Explain at-least-once delivery and why consumers must be idempotent
- Use a queue to smooth bursts and retry failed work
Caching and Messaging interview questions
What is cache invalidation and why is it hard?
It is removing or updating cached entries when the source data changes. It is hard because the cache and database are updated separately, so races, failures and multiple writers can leave the cache serving stale or inconsistent values.
Why should message consumers be idempotent?
Most brokers guarantee at-least-once delivery, so the same message may arrive twice after a retry or failure. An idempotent consumer produces the same result on repeat processing, preventing duplicate charges or duplicate records.
Where Caching and Messaging fits in the System Design roadmap
Caching and Messaging belongs to the Data at Scale stage (advanced level), which takes about 32 hours. Store and move data.
Other units in this stage
Back to the full System Design roadmap