Code Room
System designMediumsd-g531
Subject Key value storeLevel Entry–Mid~35 minCommon in Algorithms & data structures interviewsIndustries Software development, Technology

Question

Design a simple in-memory key-value store (like a tiny Redis) for a single server, exposing GET, SET, and DELETE over a network API. It should hold a few million keys, support optional per-key TTL expiration, and survive a restart by reloading recent data. Discuss the data structures, how TTL is handled, and how you'd persist data so a crash doesn't lose everything.

What a strong answer looks like

Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.

Narrate your design
Loading whiteboard…
Run or narrate your approach, then ask the coach.