Skip to content

Instantly share code, notes, and snippets.

@vireshas
Last active July 4, 2016 06:09
Show Gist options
  • Save vireshas/99bc322cf0ac42fbf7ee to your computer and use it in GitHub Desktop.
Save vireshas/99bc322cf0ac42fbf7ee to your computer and use it in GitHub Desktop.
Using redi2casa gem.
#hincrby & hget
r.hincrby "c", "e", 10
r.hincrby "c", "e", -10
r.hget "c", "e"
r.hget "c", "e", "counters" #counters is the default type
#hset & hget
r.hset "a", "b", "hello_world"
r.hget "a", "b", "sets"
#hgetall
r.hgetall "c" or r.hgetall "c", "counters" #counters is the default type
r.hgetall "a", "sets"
#lpush, ltrim, lpop, lrange
r.lpush "a", "hello"
r.lpush "a", "hello1"
r.lpush "a", "hello2"
r.lrange "a", 0, -1
r.lpop "a"
r.ltrim "a", 0, 1
#rpush, rpop
r.rpush "a", "hello3"
r.rpop "a"
r.lrange "a", 0, -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment