1 first, create a sortedset. The command is as follows: The zaddmyset1000 clerk is a command to add a collection element. Zadd indicates adding myset indicates that the Set Name 1000 indicates the key, and the clerk indicates the key. Returns the elements of myset from small to large. 0-1 indicates the subscript. If it is 0-1, all are displayed. If it is a normal range, then
1 first, create a sorted set. The command is as follows: zadd myset 1000 is a command to add a collection element. Zadd indicates adding myset indicates that the Set Name 1000 indicates the key, and the clerk indicates the key. Returns the elements of myset from small to large. 0-1 indicates the subscript. If it is 0-1, all are displayed. If it is a normal range, then
1 first, create a sorted set. The command is as follows:
Zadd myset 1000 "clerk" is a command to add a collection element. Zadd indicates adding myset indicates that the Set Name 1000 indicates the key and the clerk indicates the value.
Returns the elements of myset from small to large. 0-1 indicates the subscript. If it is 0-1, all are displayed. If it is a normal range value, all values in the range of this subscript will be displayed. <Strong? Http: www.2cto.com kf ware vc "target =" _ blank "class =" keylink "> VcD4KPHA + yOe3tbvYMC00tcTPwrHqtcTWsM67w/uzxqGjPC9wPgo8cD48aW1nIHNyYz0 = "http://www.2cto.com/uploadfile/Collfiles/20140326/2014032609094024.png" alt = "\">
If you want to display the key value at the same time, you should include the withscores parameter.
If you want to use the descending order, you can use the ZREVRANGE command.
Because myset is sorted, to return the data, you only need to traverse the time complexity to O (N ). If not sorted, O (NlogN) is required)