Redis Zrank 命令

更新时间: 2019-07-07 15:54

Redis Zrank 返回有序集中指定成员的排名。其中有序集成员按分数值递增(从小到大)顺序排列。

语法

redis Zrank 命令基本语法如下:

redis 127.0.0.1:6379> ZRANK key member

可用版本

>= 2.0.0

返回值

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

实例

redis 127.0.0.1:6379> ZRANGE salary 0 -1 WITHSCORES        # 显示所有成员及其 score 值
1) "peter"
2) "3500"
3) "tom"
4) "4000"
5) "jack"
6) "5000"

redis 127.0.0.1:6379> ZRANK salary tom                     # 显示 tom 的薪水排名,第二
(integer) 1

查看更多 Redis 有序集合(sorted set)命令

Responsive Web Design

Responsive Web Design

Ethan Marcotte / Happy Cog / 2011-6 / USD 18.00

From mobile browsers to netbooks and tablets, users are visiting your sites from an increasing array of devices and browsers. Are your designs ready? Learn how to think beyond the desktop and craft be......一起来看看 《Responsive Web Design》 这本书的介绍吧!

在线进制转换器

在线进制转换器

各进制数互转换器

随机密码生成器

随机密码生成器

多种字符组合密码

MD5 加密

MD5 加密

MD5 加密工具