Zset-ZREVRANGEBYSCORE

zrevrangebyscore与zrangebyscore的不同有俩点:
1. 就是排序,该命令为递减排序。
2. min max参数的位置
 
命令行格式:
zrevrangebyscore key max min [withscores] [limit offset count]
 
 
注意:
该命令在redis2.2.0版本之后才有。
 
命令演示:
127.0.0.1:6379> zrangebyscore rank -inf +inf withscores
1) "zhangsan"
2) "8"
3) "wangwu"
4) "9"
5) "zhaoliu"
6) "11"
7) "lisi"
8) "12"
127.0.0.1:6379> zrevrangebyscore rank +inf -inf 
1) "lisi"
2) "zhaoliu"
3) "wangwu"
4) "zhangsan"
127.0.0.1:6379> 
127.0.0.1:6379> 
127.0.0.1:6379> zrevrangebyscore rank +inf -inf withscores limit 0 2
1) "lisi"
2) "12"
3) "zhaoliu"
4) "11"
127.0.0.1:6379>
 
作者:红雨
出处:https://www.cnblogs.com/52why
微信公众号: 红雨python
原文地址:https://www.cnblogs.com/52why/p/14339027.html