Skip to content

Instantly share code, notes, and snippets.

@westhood
Created April 17, 2013 14:57
Show Gist options
  • Select an option

  • Save westhood/5404986 to your computer and use it in GitHub Desktop.

Select an option

Save westhood/5404986 to your computer and use it in GitHub Desktop.
Use redis-cli to insert massive data in python
import subprocess
p = subprocess.Popen(["redis-cli", "--pipe"],
stdin=subprocess.PIPE)
for x in xrange(0, 100):
# write to redis-cli stdin in redis protocol
p.stdin.write("set %s %s\r\n" % (x, x + 1)
p.stdin.close()
p.wait()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment