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>

 

 
上一篇:redis相关命令


下一篇:redis--v类型ZSet