Skip to content

Instantly share code, notes, and snippets.

@yankov
Created July 3, 2012 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yankov/3038384 to your computer and use it in GitHub Desktop.
Save yankov/3038384 to your computer and use it in GitHub Desktop.
generate redis protocol
# 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