**Command prototypes** |
**Complexity of Time** |
**Command description** |
**return value** |

**Zadd** key score member [score] [member] |
O (log (N)) |
N in the time complexity represents the number of members in the Sorted-sets. Add all the members specified in the parameter and their fractions to the sorted-set of the specified key, in which we can specify multiple sets of Score/member as parameters. If a member already exists in the parameter when it is added, the command updates the member's score to the new value, and then re-sorts the member based on the new value. If the key does not exist, the command creates a new sorted-sets Value for the key and inserts the Score/member pair into it. If the key already exists, but the value associated with it is not a sorted-sets type, the associated error message is returned. |
The number of members actually inserted in this operation. |

**Zcard** Key |
O (1) |
Gets the number of members contained in the sorted-sets associated with the key. |
Returns the number of members in the Sorted-sets, or 0 if the key does not exist. |

**zcount**Key min max |
O (log (N) +m) |
N in the time complexity represents the number of members in the Sorted-sets, and M represents the number of elements between Min and Max. This command is used to get the number of members of the fraction (score) between Min and Max. For the min and Max parameters, it is necessary to note that**-inf** and **+inf** represent the highest and lowest values of the scores in the Sorted-sets, respectively. By default, Min and Max represent a range of closed intervals, that is, members within **min <= score <= Max** will be returned. However, by adding "**(**" characters before Min and Max, we can indicate an open interval, such as (min max = **min < score <= Max**, and (min) (max = **min < score & Lt Max**. |
SCORE specifies the number of members within the range. |

**Zincrby**Key Increment member |
O (log (N)) |
N in the time complexity represents the number of members in the Sorted-sets. The command increments the specified score for the specified member in the specified key. If the member does not exist, the command adds the member and assumes its initial score is 0, and then adds its score to increment. If the key does not exist, the command creates the key and its associated sorted-sets, and contains the member specified by the parameter, with a fraction of the increment parameter. If the key is not associated with the Sorted-sets type, the associated error message is returned. |
A new score expressed as a string. |

**Zrange**key start stop [Withscores] |
O (log (N) +m) |
N in the time complexity represents the number of members in the Sorted-set, and M indicates the number of members returned. The command returns a member in the order of the parameter start and stop specified, where the start and stop parameters are 0-based, that is, 0 represents the first member, and 1 represents the last member. If start is greater than the maximum index value in the Sorted-set, or Start > Stop, an empty collection is returned. If stop is greater than the maximum index value, the command returns the last member from start to the collection. If the command has the optional parameter withscores option, the command will include the fractional value of each member in the returned result, such as value1,score1,value2,score2 .... |
Returns the list of members of the index between start and stop. |

**zrangebyscore** key min Max [withscores] [LIMIT offset Count] |
O (log (N) +m) |
N in the time complexity represents the number of members in the Sorted-set, and M indicates the number of members returned. The command returns all the members of the fraction between Min and Max, which satisfies the member of the expression min <= score <= Max, where the returned members are returned in order of their fractions from low to high, and if the members have the same score, they are returned in the dictionary order of the members. The optional parameter limit is used to restrict the number range of returned members. An optional parameter, offset, returns from the eligible offset member, returning count members. The meaning of the optional parameter withscores refers to the description of this option in Zrange. Finally, it is necessary to note that the rules for Min and Max in the parameters can be referenced by the command zcount. |
Returns a list of members in a specified range of fractions. |

**Zrank** Key Member |
O (log (N)) |
N in the time complexity represents the number of members in the Sorted-set. The members in Sorted-set are stored in sequential order from low to high, and the command returns the position value of the specified member in the parameter, where 0 represents the first member, which is the member with the lowest score in Sorted-set. |
If the member exists, the index value of its position is returned. Otherwise, nil is returned. |

**Zrem** Key member [member ...] |
O (M log (N)) |
In time complexity, n represents the number of members in the Sorted-set, and M indicates the number of members to be deleted. The command removes the member specified in the parameter, and the non-existent member is ignored. If the value associated with the key is not sorted-set, the corresponding error message is returned. |
The number of members that were actually deleted. |

**zrevrange** Key Startstop[withscores] |
O (log (N) +m) |
N in the time complexity represents the number of members in the Sorted-set, and M indicates the number of members returned. The function and Zrange of the command are basically the same, except that the command is to get the members of the specified position in reverse order, that is, from high to low. If members have the same score, they are sorted in descending dictionary order. |
Returns the specified list of members. |

**Zrevrank**Key Member |
O (log (N)) |
N in the time complexity represents the number of members in the Sorted-set. The function and Zrank of the command are basically the same, except that the command gets an index from high to low, and the same 0 represents the first element, the member with the highest score. |
If the member exists, the index value of its position is returned. Otherwise, nil is returned. |

**Zscore**Key Member |
O (1) |
Gets the fraction of the specified member of the specified key. |
If the member exists, returns its fraction as a string, otherwise nil. |

**zrevrangebyscore**key Max min [withscores] [LIMIT offset Count] |
O (log (N) +m) |
N in the time complexity represents the number of members in the Sorted-set, and M indicates the number of members returned. This command, in addition to sorting based on the order of fractions from high to low, has the same meaning as Zrangebyscore for other functions and parameters. |
Returns a list of members in a specified range of fractions. |

**Zremrangebyrank**key Start stop |
O (log (N) +m) |
N in the time complexity represents the number of members in the Sorted-set, and M indicates the number of members to be deleted. The delete index position is the member between start and stop, both start and stop are 0-based, that is, 0 represents the lowest fraction of the member, 1 represents the last member, that is, the member with the highest score. |
The number of members that were deleted. |

**zremrangebyscore**Key min max |
O (log (N) +m) |
N in the time complexity represents the number of members in the Sorted-set, and M indicates the number of members to be deleted. Removes all members of the fraction between Min and Max, which satisfies all members of the expression min <= score <= max. The min and max parameters can be expressed in an open interval, with specific rules referencing zcount. |
The number of members that were deleted. |