Redis Zrevrank 命令

Redis 教程 · 2019-03-08 05:59:29

Redis Zrevrank 命令返回有序集中成员的排名。其中有序集成员按分数值递减(从大到小)排序。

排名以 0 为底,也就是说, 分数值最大的成员排名为 0 。

使用 ZRANK 命令可以获得成员按分数值递增(从小到大)排列的排名。

语法

redis Zrevrank 命令基本语法如下:

redis 127.0.0.1:6379> ZREVRANK key member

可用版本

>= 2.2.0

返回值

如果成员是有序集 key 的成员,返回成员的排名。 如果成员不是有序集 key 的成员,返回 nil 。

实例

redis 127.0.0.1:6379> ZRANGE salary 0 -1 WITHSCORES     # 测试数据
1) "jack"
2) "2000"
3) "peter"
4) "3500"
5) "tom"
6) "5000"

redis 127.0.0.1:6379> ZREVRANK salary peter     # peter 的工资排第二
(integer) 1

redis 127.0.0.1:6379> ZREVRANK salary tom       # tom 的工资最高
(integer) 0

点击查看所有 Redis 教程 文章: https://codercto.com/courses/l/33.html

查看所有标签

Letting Go of the Words

Letting Go of the Words

Janice (Ginny) Redish / Morgan Kaufmann / 2007-06-11 / USD 49.95

"Redish has done her homework and created a thorough overview of the issues in writing for the Web. Ironically, I must recommend that you read her every word so that you can find out why your customer......一起来看看 《Letting Go of the Words》 这本书的介绍吧!

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具