The Simplest Model
A key value store is the most basic database shape. You store an opaque value under a unique key and later fetch it back by that exact key. The store treats the value as a blob and does not look inside it.
What You Can and Cannot Do
- Get returns the value for a key, and put stores or replaces it.
- Lookups by key are extremely fast, often a single hash lookup.
- You generally cannot query by the contents of the value, only by the key.
Common Use Cases
- Caching computed results or session data keyed by an id.
- Feature flags and configuration looked up by name.
- User sessions keyed by a session token.
Designing the Key
Because the key is the only way in, the key must encode everything you need to find the value. Teams build composite keys like user 42 cart, packing the access pattern into the key itself. If you need a second way to find the same data, you usually store it again under a second key.
Key idea
A key value store offers only fast get and put by exact key, so the key must carry the access pattern and the value stays opaque.