In-memory key-value store

DesignMedium35 min

Your task

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.

It covers

  • Hashing
  • Persistence