Skip to content
IT glossary
DatabasesUpdated December 3, 2026

Key-value store

Key-value хранилище

This type of storage associates each value with a unique key. An application uses that key to look up, replace, or delete the value.

The basic idea

A key-value store is like a dictionary shared by an application or several services. If a URL shortener receives the code k7m2, it can use that code as a key and retrieve the destination URL as the value. Each key identifies one entry within a namespace, but multiple keys can point to identical values. The important question is whether the application already knows the key at the time of the lookup.

How reads and writes work

The basic operations are GET to read a value, PUT or SET to write one, and DELETE to remove an entry. Writing to an existing key normally replaces its value. In a minimal key-value store, values are opaque: the store can return the saved bytes without knowing whether they represent text, JSON, or an image. Some products, such as Redis, also support structured values and commands that update parts of them.

Key-value describes the access model, not the storage engine. A store can hold data in memory, on disk, or use both. Expiration, durability, replication, and consistency guarantees vary by product and configuration. A key lookup may take little work inside the database, but application latency can still be dominated by a network round trip or by transferring a large value.

Example: looking up a short link

SET link:k7m2 "https://example.com/docs"
GET link:k7m2

The application receives k7m2, constructs the key link:k7m2, and reads the destination in one lookup. The link: prefix is a naming convention that separates link keys from other keys used by the application. If the short code must be unique, use a conditional write that succeeds only when the key is absent. A separate read followed by an unconditional write can race with another request that picked the same code.

Where the model fits

Sessions keyed by session ID, cached responses keyed by request parameters, and account settings read by account ID all fit this pattern. A request like “list every short link created by this account” is different: it starts with the account ID, not the link code. You would need a separate lookup structure, a secondary index if the store supports one, or a database better suited to that query. Storing JSON as a value does not automatically make its fields searchable.

What to explain in an interview

Start with the reads and writes the application needs, then propose a key and a value. Spell out what a missing key means. For a cache, a miss usually triggers a read from the source database; for a short-link service using the store as its source of truth, it might mean the link does not exist. That distinction drives decisions about expiration, backups, and recovery. If the store is distributed, also consider whether traffic is evenly spread: one viral link can become a hot key even when the rest of the keys are well distributed.