summaryrefslogtreecommitdiff
path: root/redis/client.py
diff options
context:
space:
mode:
Diffstat (limited to 'redis/client.py')
-rw-r--r--redis/client.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/redis/client.py b/redis/client.py
index 0841c04..3dabcf4 100644
--- a/redis/client.py
+++ b/redis/client.py
@@ -208,7 +208,7 @@ class Redis(threading.local):
),
string_keys_to_dict(
'DECRBY HLEN INCRBY LLEN SCARD SDIFFSTORE SINTERSTORE '
- 'SUNIONSTORE ZCARD ZREMRANGEBYSCORE ZREVRANK',
+ 'SUNIONSTORE ZCARD ZREMRANGEBYRANK ZREMRANGEBYSCORE ZREVRANK',
int
),
string_keys_to_dict(
@@ -996,10 +996,19 @@ class Redis(threading.local):
"Remove member ``value`` from sorted set ``name``"
return self.execute_command('ZREM', name, value)
+ def zremrangebyrank(self, name, min, max):
+ """
+ Remove all elements in the sorted set ``name`` with ranks between
+ ``min`` and ``max``. Values are 0-based, ordered from smallest score
+ to largest. Values can be negative indicating the highest scores.
+ Returns the number of elements removed
+ """
+ return self.execute_command('ZREMRANGEBYRANK', name, min, max)
+
def zremrangebyscore(self, name, min, max):
"""
Remove all elements in the sorted set ``name`` with scores
- between ``min`` and ``max``
+ between ``min`` and ``max``. Returns the number of elements removed.
"""
return self.execute_command('ZREMRANGEBYSCORE', name, min, max)
@@ -1283,3 +1292,4 @@ class Pipeline(Redis):
def select(self, *args, **kwargs):
raise RedisError("Cannot select a different database from a pipeline")
+