Design a simple key-value API: clients set and get string values by key, with optional TTL per key. The system should persist data across restarts, support concurrent clients, and provide strong consistency per key within a single datacenter.
Functional requirements
- PUT key-value pairs and GET values by key
- DELETE keys and return clear not-found semantics
- Optional per-key TTL or expiration timestamp
- Optional compare-and-swap conditional write for a single key
Non-functional requirements
- Low read/write latency for small payloads
- Durability on disk or replicated write-ahead log
- Horizontal read scaling via replicas where acceptable