Created
July 3, 2012 08:02
-
-
Save yankov/3038384 to your computer and use it in GitHub Desktop.
generate redis protocol
This file contains hidden or 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
# refactored version from http://redis.io/topics/mass-insert | |
def gen_redis_proto(*cmd) | |
cmd.inject("*#{cmd.length}\r\n") {|acc, arg| | |
acc << "$#{arg.length}\r\n#{arg}\r\n" | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment