ZREMRANGEBYRANK command in redis

ZREMRANGEBYRANK key start stop

This command removes all members in a sorted set within the given indexes

Redis ZREMRANGEBYRANK command removes all elements in the sorted set stored at the key with the rank between the 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.

RETURN VALUE

Integer reply, the number of elements removed.

Syntax:

ZREMRANGEBYRANK key start stop

Example

redis:6379> ZADD mykey 0 A 2 C 3 D 1 E
(integer) 4
redis:6379> ZREMRANGEBYRANK mykey 0 3
(integer) 4

Output

4

No comments:

Post a Comment