Looking for redis Answers? Try Ask4KnowledgeBase
Looking for redis Keywords? Try Ask4Keywords

redisSorted Sets


The Sorted Set datatype in Redis is an ordered version of the Set datatype. A Redis sorted set consists of a collection of unique members. Each member in the sorted set can be thought of as a pair consisting of the member and a score. The score is used to order the members within the set in ascending order.


  • ZADD key [NX|XX] [CH] [INCR] score member [score member ...]
  • ZCARD key
  • ZCOUNT key min max
  • ZLEXCOUNT key min max


The official documentation for Sorted Sets can be found at the Redis.io site.

Sorted sets are sometimes referred to as zsets. If you use the TYPE command on a sorted set key, the value zset will be returned.