Redis命令-有序集合-zremrangebyrank
原文
http://redis.io/commands/zremrangebyrank
简介
Remove all members in a sorted set within the given indexes.
从有序集合中删除指定索引范围内的所有成员。
语法
ZREMRANGEBYRANK key start stop
版本
Available since 2.0.0.
自2.0.0版本可用。
时间复杂度
Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.
O(M*log(N)):N是有序集合中元素的数量,M是要删除的元素的数量。
描述
Removes all elements in the sorted set stored at key with rank between start and stop. Both start and stop are 0 -based indexes with 0 being the element with the lowest score. These indexes can be negative numbers, where they indicate offsets starting at the element with the highest score. For example: -1 is the element with the highest score, -2 the element with the second highest score and so forth.
从有序集合中删除索引在start和stop之间的所有元素。start和stop都是基于0的索引,0表示分数最低的元素。这些索引可以是负数,表示从分数最高的元素计算偏移。例如:-1表示分数最高的元素,-2表示分数次高的元素等等。
返回值
Integer reply: the number of elements removed.
删除的元素数量。
例子
redis> ZADD myzset 1 "one"
(integer) 1
redis> ZADD myzset 2 "two"
(integer) 1
redis> ZADD myzset 3 "three"
(integer) 1
redis> ZREMRANGEBYRANK myzset 0 1
(integer) 2
redis> ZRANGE myzset 0 -1 WITHSCORES
1) "three"
2) "3"
redis>
- Redis有序集合命令ZRANGEBYSCORE|ZREVRANGEBYSCORE|ZREMRANGEBYRANK|ZREMRANGEBYSCORE
- Redis命令-有序集合-zremrangebyscore
- Redis命令-有序集合-zremrangebylex
- Redis有序集合命令ZRANGEBYLEX详解与应用
- Redis 与有序集合(sorted set)相关的命令
- Redis命令-有序集合-zscan
- Redis有序集合命令ZREMRANGEBYLEX详解与应用
- 六、Redis 基础命令--有序集合
- Redis有序集合类型的常用命令小结
- Redis的Sorted Set有序集合命令
- redis命令之有序集合(zset)
- Redis大总结之三:SORT命令(对 列表|集合|有序集合 进行排序)
- redis基本命令之二:集合、有序集合
- Java实现Redis的有序集合(sortedset)命令
- Redis命令-有序集合-zscore
- Redis命令-有序集合-zunionstore
- Redis命令zrange,zrangebyscore,zrevrank,zremrangebyscore
- Redis命令学习-SortedSet(有序集合)
- redis必杀命令:有序集合(sorted set)
- Redis从基础命令到实战之有序集合类型(SortedSet)