Redis Explained: What It Is and When to Use It
Redis gets described as "just a cache" often enough that people underestimate it, which is a shame — it's a genuinely versatile tool, and understanding what it's actually doing under the hood makes it obvious why it shows up in so many production systems.
What Redis actually is
Redis is an in-memory data store — it keeps data in RAM instead of on disk, which is why it's dramatically faster than a traditional database for the operations it supports. Reading from memory takes microseconds; reading from disk, even a fast SSD, takes meaningfully longer. That speed difference is the entire reason Redis exists.
Unlike a plain key-value cache, Redis supports genuinely useful data structures directly — strings, lists, sets, sorted sets, hashes — which means you're not limited to storing and retrieving simple blobs. You can push and pop from a list, increment a counter atomically, or query a sorted set by score, all as native, fast operations.
Where Redis actually gets used
- Caching: the most common use — store the result of an expensive database query or API call in Redis, and serve it from memory on subsequent requests instead of recomputing it every time.
- Session storage: user session data needs to be read and written constantly and doesn't need long-term durability guarantees, which makes it a natural fit for something this fast.
- Rate limiting: Redis's atomic counter operations make "has this IP made too many requests in the last minute" a fast, reliable check.
- Real-time leaderboards: its sorted sets are built almost exactly for "top 10 by score" queries, updated constantly.
- Pub/sub messaging: Redis can broadcast messages between different parts of a system in real time, which is handy for things like live notifications.
- Job queues: many background job systems use Redis as the backing store for tasks waiting to be processed.
The trade-off you need to understand
Redis's speed comes from living in memory, and memory is both more expensive and less durable than disk by default. If your Redis server restarts, data can be lost unless you've explicitly configured persistence (Redis does support this, with some trade-offs of its own). The practical implication: Redis is excellent for data that's either disposable or reconstructible — a cache can always be rebuilt from the source database — and it needs careful configuration if you're using it for anything you genuinely can't afford to lose.
When you should actually reach for it
If you have a query or computation that's expensive and doesn't need to be recalculated on every request, cache it in Redis. If you're building anything involving rate limits, real-time counters, or leaderboards, Redis solves that job better than a general-purpose relational database ever will. If your data absolutely must survive a server restart and can't be reconstructed from anywhere else, that's better suited to a database designed around durability as the primary goal, like Postgres.
Knowing exactly which pieces of a system belong in a fast, ephemeral store like Redis versus a durable database is a decision we make on nearly every cloud infrastructure project — and getting it right is often the difference between a product that stays fast under real load and one that quietly slows down as it grows.