Last active
August 29, 2015 14:25
-
-
Save agrison/37d55becc579b4d840fc to your computer and use it in GitHub Desktop.
Generate 1M redis SET commands using redis protocol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import uuid, sys | |
def redis_protocol(cmd): | |
proto = "*%d\r\n" % len(cmd.split(' ')) | |
for arg in cmd.split(' '): | |
proto += "$%d\r\n%s\r\n" % (len(arg), arg) | |
return proto | |
sample = "" | |
for _ in xrange(1000000): | |
sample += redis_protocol("SET %s %s" % (uuid.uuid4(), uuid.uuid4())) | |
print(sample, file=open('sample2.input', 'w+')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment