Skip to content

Instantly share code, notes, and snippets.

@72squared
Last active October 22, 2015 16:50
Show Gist options
  • Save 72squared/5d554bc1232c55f4179d to your computer and use it in GitHub Desktop.
Save 72squared/5d554bc1232c55f4179d to your computer and use it in GitHub Desktop.
from rediscluster import RedisCluster
startup_nodes = [{"host": "127.0.0.1", "port": 7000}]
r = RedisCluster(startup_nodes=startup_nodes, max_connections=32, decode_responses=True)
for i in xrange(1000000):
d = str(i)
pipe = r.pipeline(transaction=False)
pipe.set(d, d)
pipe.incrby(d, 1)
pipe.execute()
pipe = r.pipeline(transaction=False)
pipe.set("foo-%s" % d, d)
pipe.incrby("foo-%s" % d, 1)
pipe.set("bar-%s" % d, d)
pipe.incrby("bar-%s" % d, 1)
pipe.set("bazz-%s" % d, d)
pipe.incrby("bazz-%s" % d, 1)
pipe.execute()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment