Design a key-value store
Design an in-memory key-value store that supports multiple data structures (sorted sets, lists, etc.) and can be configured with different eviction strategies like LRU, LFU, or TTL-based expiration.
Asked at:
Microsoft
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid December, 2025
Microsoft
Staff
The first part is a common question: implement an in-memory key/value store (think Redis-lite). The twist is you’re expected to design it so it can support multiple data structures (like a sorted set, list, etc.) and plug in different eviction strategies. I ended up implementing it using the Strategy pattern, with heavy use of interfaces to keep the storage layer, data-structure layer, and eviction policy decoupled.
Your account is free and you can post anonymously if you choose.