beginnerRedis — Data Structures, Persistence & Pub/Sub
What is a Redis Sorted Set and what are its use cases?
A Sorted Set is a collection of unique elements, each associated with a floating-point score. Elements are ordered by score. Operations: ZADD (add), ZRANGE (by rank), ZRANGEBYSCORE (by score), ZREVRANGE (reverse order), ZINCRBY (increment score), ZRANK (get rank). Time complexity: O(log N) for most operations. Use cases: 1) Leaderboards: ZADD game:scores 1500 'alice'; ZREVRANGE game:scores 0 9 (to
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response