Skip to content
IT glossary
BackendUpdated December 3, 2026

Redis

Redis is a data store that keeps data in memory and looks it up by key. Applications often use it to share a fast cache, track sessions, or update counters.

What Redis does

Redis is a server that applications contact over the network to read and update data by key. Think of a shopping site with several backend instances: instead of keeping a separate copy of each cached product on every instance, they can all look up product:42 in Redis. Redis serves the working data from RAM, so a lookup usually doesn't have to wait for a disk read. It still involves a network round trip, unlike a lookup in the application's own memory.

How Redis stores and updates data

Redis can store more than strings. A hash holds named fields, a set tracks unique members, and a sorted set orders members by score. A game can update one player's score and fetch the top ten without downloading or sorting the whole leaderboard in application code. Individual commands such as INCR are atomic: two clients incrementing the same counter won't overwrite each other's updates. That guarantee doesn't automatically extend to multiple commands sent separately.

Keys can have a time to live (TTL). Once a key expires, reads treat it as missing. Expiration is different from eviction: when Redis reaches its configured memory limit, the eviction policy determines whether it can discard keys to make room or must reject writes that need more memory. A key with a ten-minute TTL can therefore disappear sooner.

Example: caching a product lookup

SET product:42 '{"name":"Mug","price_cents":1200}' EX 60
GET product:42

Here, SET stores the JSON as a string and sets a 60-second TTL. With a cache-aside design, the application tries GET first. On a miss, it reads from the primary database and populates Redis. If someone updates the price, the application can invalidate the cached copy by deleting the key after updating the database. Waiting for the TTL instead is simpler, but customers can see the old price until the entry expires.

Uses, trade-offs, and interviews

Redis also fits workloads such as shared sessions, rate-limit counters, and leaderboards. Decide what losing a key would mean before choosing a memory policy or a persistence configuration. A missing product entry can be rebuilt from the database; a missing session can log someone out. For recovery after a restart, Redis can use RDB snapshots, an append-only file (AOF) that records writes, or both. Persistence doesn't necessarily mean every acknowledged write will survive a crash.

In a system design interview, don't stop at “put Redis in front of the database.” Explain what happens on a miss, how stale data is handled, and what happens when the cache goes down. For example, if a popular key expires, many backend requests may try to rebuild it at once. Having those requests share one in-flight database lookup can protect the database from that burst.