Overview
Design an in-memory cache that spreads keys across nodes with consistent hashing, replicates for fault tolerance, and evicts entries by a policy you choose.
Requirements
- 01Answer get(key) and put(key, value) in under a millisecond
- 02Spread keys across nodes with consistent hashing and virtual nodes
- 03Support LRU, LFU, and TTL eviction policies
- 04Replicate from primary to replica with automatic leader election (Raft or Sentinel)
- 05Take persistence snapshots (RDB/AOF style) without blocking reads and writes
Concepts in play
Consistent HashingLRU CacheReplicationIn-MemoryRaft