Command Palette

Search for a command to run...

Roadmap
Phase 10Intermediate13 of 19 in the curriculum

Caching + Messaging

Cache placement, cache invalidation, Redis, Kafka — where latency and decoupling actually live.

Two tools do more for a system's behavior than any other: caches (latency) and queues (decoupling). This phase covers every cache strategy you'll be asked about, then the full Kafka mental model with its delivery semantics and failure story.

For every strategy, learn the failure mode first — cache invalidation and message duplication are where interviews get real.

0/16 · 0%
16 topics ~2 h 14 code blocks & diagrams
Start with the first topic
1
10.1

Why Cache?

Latency and load: the same data read 1000x a second shouldn't hit the DB 1000x.

6 min 1 diagram practice

2
10.2

Cache-aside (Lazy Loading)

The app checks the cache, loads from the DB on miss, and writes the cache itself — the default strategy.

7 min 1 diagram 1 code practice

3
10.3

Read-through

The cache loads from the DB by itself on a miss — the app only ever talks to the cache.

6 min practice

4
10.4

Write-through

Writes go to the cache first and the cache synchronously writes the store — strong-ish, and always-on freshness.

6 min 1 diagram practice

5
10.5

Write-back (Write-behind)

Writes land in the cache and flush to the store asynchronously — fast writes, batched persistence, riskier.

6 min 1 diagram practice

6
10.6

Eviction Policies: LRU, LFU, TTL

When the cache is full, what leaves? LRU, LFU, FIFO, random, and how Redis does it.

7 min 1 code practice

7
10.7

Cache Invalidation

The hardest problem in computer science, at least for interviews: keeping the cache honest after writes.

7 min 1 diagram practice

8
10.8

Redis

The de-facto cache/state store: in-memory, single-threaded, rich data types, lua/RDB/AOF, and clustering.

7 min 1 code practice

9
10.9

Distributed Cache

A cache that scales beyond one machine and is shared by the whole fleet — Redis Cluster or a sharded layer.

6 min practice

10
10.10

Message Queue Basics

Producer → broker → consumer, and why the little words 'decouple', 'buffer', and 'retry' change everything.

7 min 1 diagram 1 code practice

11
10.11

Kafka Deep Dive

The distributed commit log: topic, partition, offset, consumer group, producer, consumer, replication — the full mental model.

12 min 1 diagram 1 code practice

12
10.12

Kafka vs Traditional Queue

Kafka = replayable log; RabbitMQ = smart router. Both are queues to a product manager and different worlds to you.

6 min practice

13
10.13

Delivery Semantics

At-most-once, at-least-once, exactly-once — the contract between producer and consumer, and where the lies live.

6 min 1 diagram practice

14
10.14

Retries

The last request failed. When do you retry, how hard, and how do retries stop being the retry-storm?

6 min practice

15
10.15

Dead Letter Queue (DLQ)

The parking lot for poison messages: retried N times, failed, and now visible to a human.

6 min 1 diagram practice

16
10.16

Idempotency

The property that makes retries, replays and at-least-once safe: same request → same result, every time.

6 min practice