无涯教程-Redis - ZREVRANGE 命令函数

61 阅读1分钟

Redis ZREVRANGE 命令返回存储在键处的排序集中的元素的指定范围,元素被认为是从最高得分到最低得分排序的,降序字典顺序用于具有相等分数的元素。

ZREVRANGE - 返回值

返回指定范围内元素的列表。

ZREVRANGE - 语法

以下是Redis ZREVRANGE 命令的基本语法。

redis 127.0.0.1:6379> ZREVRANGE key min max

ZREVRANGE - 示例

redis 127.0.0.1:6379> ZADD myzset 1 b 2 c 3 d 4 e 
(integer) 4 
redis 127.0.0.1:6379> ZREVRANGE myzset 0 -1 
1) "e" 
2) "d" 
3) "c" 
4) "b" 

参考链接

www.learnfk.com/redis/sorte…