diff options
author | andy <andy@whiskeymedia.com> | 2010-01-18 13:02:23 -0800 |
---|---|---|
committer | andy <andy@whiskeymedia.com> | 2010-01-18 13:02:23 -0800 |
commit | 33521a7d6cca8447fd885a61ffd812f634cf222c (patch) | |
tree | 8f904444ed9ee72be1fbb103689f9e81632cc234 | |
parent | 9e7b4e6a0e590e056463919c572840c2c39b111d (diff) | |
parent | a9bff80ec2d04f70c1e2bed50b70b0168ef8f8c8 (diff) | |
download | redis-py-33521a7d6cca8447fd885a61ffd812f634cf222c.tar.gz |
Merge branch 'master' into newapi
-rwxr-xr-x[-rw-r--r--] | redis/old_client.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/redis/old_client.py b/redis/old_client.py index dcccdb8..fc56f62 100644..100755 --- a/redis/old_client.py +++ b/redis/old_client.py @@ -1059,7 +1059,7 @@ class Redis(object): return self.send_command('%s %s %s %s\r\n' \ % (command, key, start, end)) - def zrangebyscore(self, key, min, max): + def zrangebyscore(self, key, min, max, offset=None, count=None): """ >>> r = Redis(db=9) >>> res = r.delete('z1') @@ -1073,9 +1073,20 @@ class Redis(object): 1 >>> r.zrangebyscore('z1', 5, 7) [u'a', u'c'] + >>> r.zadd('z1', 'e', 8) + 1 + >>> r.zrangebyscore('z1', 5, 8, offset=0, count=2) + [u'a', u'c'] + >>> r.zrangebyscore('z1', 5, 8, offset=1, count=2) + [u'c', u'e'] """ - return self.send_command('ZRANGEBYSCORE %s %s %s\r\n' % ( - key, min, max + if offset is not None and count is not None: + limit = " LIMIT %d %d" % (offset, count) + else: + limit = "" + + return self.send_command('ZRANGEBYSCORE %s %s %s%s\r\n' % ( + key, min, max, limit )) def zcard(self, key): |