Redis stands for REmote DIctionary Server. In simple language, it’s a giant key-value store that lives entirely in RAM. We talk to it over TCP, throw keys at it, and get values back in microseconds.
Think of it like a Map<String, Value> running on a separate server, except the values can be strings, lists, hashes, sets, sorted sets, streams, and a few more exotic types. That’s what makes Redis special — it’s not “just” a cache, it’s a data-structure server.
Why we use Redis
Plain databases like PostgreSQL or MySQL live on disk. Disk is slow. Redis lives in memory. Memory is fast — we’re talking sub-millisecond reads. When an app needs to respond in under 50ms and the database takes 200ms, Redis sits in front and absorbs the heat.
The classic use cases
Cache
The classic flow: check Redis first, fall back to the DB on miss, then write back into Redis.
GET product:42
# (nil) — miss, query DB
SET product:42 '{"name":"Shoe","price":99}' EX 3600
GET product:42
# "{\"name\":\"Shoe\",\"price\":99}"
Session store
When we run 10 app servers behind a load balancer, we can’t keep sessions in local memory — a user might hit a different server next request. Redis fixes that.
SET session:abc123 '{"userId":42,"role":"admin"}' EX 1800
Rate limiter
A fixed-window limiter in two commands:
INCR rate:user:42:2026-05-26T10:15
EXPIRE rate:user:42:2026-05-26T10:15 60
If INCR returns > 100, we reject the request.
Queue
LPUSH queue:emails "send:welcome:user42"
BRPOP queue:emails 0 # worker blocks until a job arrives
Leaderboard
ZADD game:leaderboard 4500 "alice" 3200 "bob" 5100 "carol"
ZREVRANGE game:leaderboard 0 9 WITHSCORES # top 10
What Redis is not
Redis is not a primary database for everything. Anything you absolutely cannot lose still belongs in Postgres. Redis is a speed layer and a purpose-built data structure server — that’s the mental model to walk into the interview with.