summaryrefslogtreecommitdiff
path: root/redis/client.py
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2010-06-15 01:40:41 -0700
committerAndy McCurdy <andy@andymccurdy.com>2010-06-15 01:40:41 -0700
commita4cd6bf21bd5ee5cb194c6f4e96bb4b2e93a5ceb (patch)
tree6a53052478541c65d87e1055ac0ebe1520bc5468 /redis/client.py
parentb686c967e71e3b406f2af4f36744a5258ceca8bb (diff)
downloadredis-py-a4cd6bf21bd5ee5cb194c6f4e96bb4b2e93a5ceb.tar.gz
added ZREMRANGEBYRANK command
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")
+