Redis
What is it?
Redis is a very fast in-memory data store used for caching and storing temporary data.
Explain like I'm 5
Redis is like keeping your favorite snacks on your desk instead of walking to the kitchen every time you're hungry.
Why was it created?
Reading from disk and databases is slow. Redis keeps data in memory so reads and writes happen in microseconds.
Where is it used?
- Caching layers in front of databases
- Session storage
- Rate limiting
- Real-time leaderboards
Why should developers care?
Almost every large web app uses an in-memory cache. You'll meet Redis on most backend teams.
How does it work?
Redis keeps key-value data in RAM and optionally persists snapshots to disk. Clients send simple commands like GET and SET over a connection.
Real-world example
A site caches a user's profile in Redis so repeat page loads skip the database.
Common use cases
- Caching
- Sessions
- Queues
- Leaderboards
Advantages
- Extremely fast
- Simple data structures
- Widely supported
Disadvantages
- Limited by available memory
- Persistence is weaker than a primary database
When should you use it?
When you need very fast access to data that can be rebuilt if lost.
When should you avoid it?
As your only store for data you cannot afford to lose.
Alternatives
MemcachedDragonflyDBKeyDB
Related terms
Interview questions
Beginner
- What is Redis used for?
Intermediate
- How does Redis handle persistence?
Senior
- How would you design a cache invalidation strategy with Redis?
Common misconceptions
- "Redis is only a cache" — it also supports queues, pub/sub, and more.
Fun facts
- The name stands for REmote DIctionary Server.
Timeline
- 2009 — First released by Salvatore Sanfilippo
Learning resources
Quick summary
Redis is an in-memory key-value store that makes apps fast by caching data in RAM.
Cheat sheet
- In-memory key-value store
- Microsecond reads
- Great for caching and sessions
If you remember only one thing
Redis trades durability for speed by keeping data in memory.