Functional
- Get, set, delete, increment, and multi-get bounded-size values.
- Expire entries and support explicit invalidation.
- Scale shards without remapping the entire keyspace.
Serve hot data quickly while controlling staleness, skew, and stampedes.
Client routing and connection reuse matter.
Use many shards with replicas and memory headroom.
Protocol and metadata overhead are material.
A 5-point drop can double source traffic.
These are reference assumptions, not universal facts. In an interview or architecture review, change them when the product context changes.
/v1/cache/{key}Return value, version, and remaining TTL./v1/cache/{key}Set bounded value with TTL and optional compare-version./v1/cache/{key}Invalidate a key across replicas.key, value, version, expires_at, sizeVersion enables safe invalidation and stale-write rejection.epoch, token_range, primary, replicasClients cache this control-plane state and reject stale epochs.Route, retry, and coalesce requests
Hold ephemeral key/value state
Provide authoritative values
Remove or refresh changed entries
Use consistent hashing with virtual nodes and weighted capacity. During movement, read old then new placement and write both until an epoch cutover; rate-limit migration to protect foreground traffic.
Coalesce concurrent misses per key, jitter TTLs, refresh hot entries before expiry, and serve slightly stale data when the source is unhealthy.
For mutable objects, write the database first, then publish versioned invalidation. A delayed older event must not delete a newer cached value. Strong read-after-write should bypass or update cache explicitly.
Use request coalescing, jittered TTLs, and stale-while-revalidate.
Remap keys gradually and protect the source from the miss surge.
Move here when: One process and small working set.
Move here when: Many service instances need a common working set.
Move here when: Cache failures threaten primary stores.
Strong answer signal: Discuss controlled movement, spare capacity, and source protection.
Strong answer signal: Version every mutation and ignore stale invalidations.
Strong answer signal: Segment by tenant, key class, shard, and source cost.