Skip to content

Instantly share code, notes, and snippets.

@mumumu
Created February 4, 2014 03:21
Show Gist options
  • Save mumumu/8797653 to your computer and use it in GitHub Desktop.
Save mumumu/8797653 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import redis
from optparse import OptionParser
from benchmarker import Benchmarker
parser = OptionParser()
parser.add_option("-n", "--num", dest="num", action="store",
help="iterate number", type="int", default=10000)
(options, args) = parser.parse_args()
r = redis.StrictRedis(host='localhost', port=6379, db=0)
with Benchmarker(width=20) as bm:
with bm('zrangebyscore'):
result = r.zrangebyscore('mykey', 1,1, 0, options.num)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment