intermediate

Redis

Use Redis data structures, TTLs, streams, pub/sub, caching patterns, and lock caveats for low-latency coordination and cached state.

Redis interviews cover in-memory data structures, TTL policies, streams, pub/sub, caching patterns, and distributed lock caveats. It is usually a cache or coordination layer—not the system of record.

Subtopics: strings, hashes, lists, sets, sorted sets, streams, TTL, pub/sub, caching patterns, distributed locks.

On interviews: pick a structure for leaderboards or rate limits, explain cache-aside invalidation, and why pub/sub is not a durable queue.

Common pitfalls: Redis as source of truth; locks without fencing; pub/sub for critical workflows; no TTL or stampede protection on hot keys.

The trade-off is balancing extreme latency against durability, correctness, and memory cost.

Checklist:

  • Choose structure by access pattern and memory shape.
  • Set TTL and invalidation with stale-data policy.
  • Treat locks as leases with idempotency or fencing.
  • Separate ephemeral pub/sub from durable streams or queues.