zremrangebyrank
ZREMRANGEBYRANK
Apply for Redis Developer Course
|
Redis Regular Inspection / Technical Support
|
Redis Enterprise Server
|
|---|
Delete members by index range
Usage: zremrangebyrank key start stop.
start stop are indexes, the same concept used by lrange.
Example
| Command> | zrange myzip 0 -1 withscores |
| Result> |
0) 1 -> New Delhi 1) 2 -> Seoul 2) 3 -> Beijing 3) 4 -> New York |
| Command> | zremrangebyrank myzip 1 2 |
| Result> | 2 |
| Command> | zrange myzip 0 -1 withscores |
| Result> |
0) 1 -> New Delhi 1) 4 -> New York |
Negative indexes are allowed
With a negative index, the last member is -1, the previous one is -2, and so on.
Example
| Command> | zadd myzip 2 "Seoul" 3 "Beijing" |
| Result> | 2 |
| Command> | zremrangebyrank myzip -3 -2 |
| Result> | 2 |
| Command> | zrange myzip 0 -1 withscores |
| Result> |
0) 1 -> New Delhi 1) 4 -> New York |
Syntax
ZREMRANGEBYRANK key start stop
- Available since version 2.0.0.
- Time complexity is O(log(N)+M). N is the number of members in the set, and M is the number of members to delete.
| Related commands | LRANGE, ZREMRANGEBYSCORE, ZREMRANGEBYLEX, LRANGE |
| Clients for Java | Jedis, Lettuce, Redisson | Clients for C | Hiredis |
| << ZRM | ZREMRANGEBYRANK | ZREMRANGEBYSCORE >> |
|---|
Email
답글이 올라오면 이메일로 알려드리겠습니다.
