Skip to content

Instantly share code, notes, and snippets.

@titanous
Created October 9, 2011 18:06
Show Gist options
  • Save titanous/1273964 to your computer and use it in GitHub Desktop.
Save titanous/1273964 to your computer and use it in GitHub Desktop.
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