Design an In-Memory Key-Value Store with TTL
Problem
Design an in-memory key-value store with expiry, like a mini-Redis.
Requirements
set(key, value, ttl)/get(key)/delete(key)- Keys expire after TTL
- Optional:
getMostRecent()
What evaluators look for
- Clean separation: store, expiry policy, eviction
- Lazy vs active expiry trade-off
- Thread safety
- O(1) operations
Extension
Add LRU eviction when a memory cap is hit; discuss interaction with TTL.
added …