diff options
author | Christian Bodt <christian.bodt@coinplus.com> | 2015-10-20 12:33:20 +0200 |
---|---|---|
committer | Christian Bodt <christian.bodt@coinplus.com> | 2015-10-20 13:02:57 +0200 |
commit | c1a53443c1a05295efbf1fcac875bd6bf132e7aa (patch) | |
tree | 1782f497eac8cb800447b44c2cc9021df1310d38 /redis/client.py | |
parent | 85b85619ed1306ac4bc260bb3bc40b2e3e4def54 (diff) | |
download | redis-py-c1a53443c1a05295efbf1fcac875bd6bf132e7aa.tar.gz |
-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..6e4c9ab 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, upper, lower, start=None, num=None): + """ + Return the reversed lexicographical range of values from sorted set + ``name`` between ``upper`` and ``lower``. + + 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, upper, lower] + 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): """ |