Created
October 9, 2011 18:06
-
-
Save titanous/1273964 to your computer and use it in GitHub Desktop.
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
def encode_hash(hash) | |
hash.map { |k,v| [k, encode(v)] } | |
end | |
def decode_hash(hash) | |
Hash[hash.map { |k,v| [k, decode(v)] }] | |
end | |
def hgetall(key) | |
decode_hash redis.hgetall(key) | |
end | |
def hmset(key, hash) | |
redis.hmset key, *encode_hash(hash).flatten | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment