Sorted Set Commands
Sorted set commands are similar to sets, but each member is associated with a score for sorting. Members are unique, but scores can be duplicated. Sorted sets are sorted from smallest to largest score.
Command List
ZADD
Adds one or more members to a sorted set, or updates the score of an existing member
ZCARD
Returns the number of elements in a sorted set
ZCOUNT
Counts the number of members in a sorted set within a specified score range
ZRANK
Returns the rank of a specified member in a sorted set (starting from 0)
ZREM
Removes one or more members from a sorted set
ZSCORE
Returns the score of a specified member in a sorted set
Use Cases
Sorted set commands are ideal for leaderboards, timelines, weighted queues, and other scenarios. Sorting functionality can be easily implemented through scores, while specific member rankings and scores can be quickly queried.
For detailed usage and parameters of each command, please refer to the individual command documentation linked above.