Back to posts

Redis: Way more than just a cache

Redis beyond the basics: data structures, pub/sub, rate limiting, queues, sessions, leaderboards and how to use it in production.

TS
Thiago Saraiva
2 min read

redis-post

When someone says Redis, most devs think "cache". And Redis is excellent as a cache. But reducing Redis to a key-value store with TTL is like using a Swiss Army knife just to open boxes.

Redis runs in memory, responds in microseconds, and offers data structures that solve problems that would be complex with a relational database.

Cache with strategy

Rate Limiting with Sorted Sets

Pub/Sub: communication between services

Leaderboard with Sorted Sets

Doing this in SQL would be an ORDER BY score DESC that degrades with scale. Redis does it in O(log n).

Distributed locks

Key Takeaways

Redis is one of the most versatile tools in the ecosystem. Caching is just the beginning. Sessions, rate limiting, queues, pub/sub, leaderboards, distributed locks -- all in microseconds. If you're using Redis only for caching, you're leaving 80% of its value on the table.