diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2015-10-20 12:19:27 -0400 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2015-10-20 12:19:27 -0400 |
commit | 93ee0b97faab8de46a77b8cf140f68912e921e0a (patch) | |
tree | cb870536f365a5d1bbddc981281778dae4eff5c7 /redis/client.py | |
parent | 85b85619ed1306ac4bc260bb3bc40b2e3e4def54 (diff) | |
parent | 18893f74950ba957f7ca746296121e2948713374 (diff) | |
download | redis-py-93ee0b97faab8de46a77b8cf140f68912e921e0a.tar.gz |
Merge pull request #667 from sirk390/master
-added zrevrangebylex
Diffstat (limited to 'redis/client.py')
-rwxr-xr-x | redis/client.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/redis/client.py b/redis/client.py index 902ccc9..3ac242b 100755 --- a/redis/client.py +++ b/redis/client.py @@ -1661,6 +1661,22 @@ class StrictRedis(object): pieces.extend([Token('LIMIT'), start, num]) return self.execute_command(*pieces) + def zrevrangebylex(self, name, max, min, start=None, num=None): + """ + Return the reversed lexicographical range of values from sorted set + ``name`` between ``max`` and ``min``. + + If ``start`` and ``num`` are specified, then return a slice of the + range. + """ + if (start is not None and num is None) or \ + (num is not None and start is None): + raise RedisError("``start`` and ``num`` must both be specified") + pieces = ['ZREVRANGEBYLEX', name, max, min] + if start is not None and num is not None: + pieces.extend([Token('LIMIT'), start, num]) + return self.execute_command(*pieces) + def zrangebyscore(self, name, min, max, start=None, num=None, withscores=False, score_cast_func=float): """ |