If you learn one Redis structure deeply, make it the sorted set. It's a set where every member carries a numeric score, and members stay ordered by that score. That one addition (a score) unlocks a remarkable range of problems: leaderboards, priority queues, time-ordered feeds, sliding-window rate limiters, and range queries by value. A large share of "how do I do X in Redis" questions have "use a sorted set" as the answer, so it's worth understanding well.

This is part 7 of the Redis Masterclass, following sets.

Members with scores, kept in order

A sorted set (zset) stores unique members, each with a score, and maintains them sorted by score:

ZADD leaderboard 1500 "alice" 1800 "bob" 1200 "carol"