Interview Q&A · questions with model answers

Caching Interview Questions

Part of the study plan for: Backend Engineer · Full Stack Engineer

Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.

  1. How do you keep cache and database consistent on writes?

    Prefer 'update the database, then delete the cache key' (not update the cache), so the next read repopulates from the source of truth; add TTLs, and for stronger needs use versioning or…

  2. Your Redis cluster has one shard at 100% CPU while others idle. What's likely and how do you fix it?

    A hot key (or big key) on that shard: clusters spread keys, not requests. Add an in-process L1 cache for it, replicate the key across slots, or split big values; find culprits with --hotkeys /…

  3. How do you keep in-process L1 caches on many pods consistent?

    Broadcast invalidations (Redis pub/sub, Kafka, or Redis client-side tracking) so every pod evicts on writes, and keep L1 TTLs short as a backstop because pub/sub messages can be lost.

  4. After adding a Redis cache, users sometimes see stale or wrong data. How do you investigate and fix it?

    Find how entries become stale: writes that don't invalidate the cache, a race between a slow read repopulating the cache with old data after an update, keys that don't include everything the result…

Was this page helpful?

Report a mistake