Redis Zremrangebyrank 命令

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

Redis Zremrangebyrank 命令用于移除有序集中,指定排名(rank)区间内的所有成员。

语法

redis Zremrangebyrank 命令基本语法如下:

redis 127.0.0.1:6379> ZREMRANGEBYRANK key start stop

可用版本

>= 2.0.0

返回值

被移除成员的数量。

实例

redis 127.0.0.1:6379> ZADD salary 2000 jack
(integer) 1
redis 127.0.0.1:6379> ZADD salary 5000 tom
(integer) 1
redis 127.0.0.1:6379> ZADD salary 3500 peter
(integer) 1

redis 127.0.0.1:6379> ZREMRANGEBYRANK salary 0 1       # 移除下标 0 至 1 区间内的成员
(integer) 2

redis 127.0.0.1:6379> ZRANGE salary 0 -1 WITHSCORES    # 有序集只剩下一个成员
1) "tom"
2) "5000"

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

Introduction to Programming in Java

Introduction to Programming in Java

Robert Sedgewick、Kevin Wayne / Addison-Wesley / 2007-7-27 / USD 89.00

By emphasizing the application of computer programming not only in success stories in the software industry but also in familiar scenarios in physical and biological science, engineering, and appli......一起来看看 《Introduction to Programming in Java》 这本书的介绍吧!

JS 压缩/解压工具

JS 压缩/解压工具

在线压缩/解压 JS 代码

图片转BASE64编码

图片转BASE64编码

在线图片转Base64编码工具

UNIX 时间戳转换

UNIX 时间戳转换

UNIX 时间戳转换