Skip to content

Key-Value Store

In one line

A key-value store is a NoSQL database where every item is a unique key mapped to a value — no schema, no relations.

In simple words

A key-value store is the simplest type of NoSQL database. Every piece of data is stored as a pair: a unique key and a value. You can set a value by key, get a value by key, and delete a key — that is the core API.

For example:

  • SET user:1:name "Ada" → stores "Ada" under the key "user:1:name"
  • GET user:1:name → returns "Ada"
  • DEL user:1:name → removes the key

The value can be a string, number, blob, or (in richer stores like Redis) a list, set, or hash. The database does not understand the contents of the value — it just stores and retrieves it by key.

Key-value stores are extremely fast and simple. They are great for caching, session storage, and configuration. They are not good for complex queries, joins, or ad-hoc filtering — you can only look up by exact key. Redis, DynamoDB, and Memcached are popular key-value stores.

Example

bash
# Redis key-value operations
SET session:abc123 "user=42"
GET session:abc123     # → "user=42"
EXISTS session:abc123  # → 1 (true)
DEL session:abc123     # → 1 (deleted)
EXISTS session:abc123  # → 0 (false)

Basic key-value operations: set a value, get it by key, check existence, and delete.

Related terms

Related Resources

Related Lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary