Tag Archives: keys

Notes on Redis DB

  • Redis provides atomic operations on keys
  • Keys can have TTL (-2 expired, -1 never expire, n seconds to expire)
  • Values are stored as a list.
    • The list is indexed and can be queried with ranges.
  • List items can be popped, Left/Right pushed.
  • Values can also be stored as set.
    • Set operations: add, remove, is_member, members, union
  • Values also support sorted sets, using a user defined sorting key
  • Another value type is Hashed values.
    • key : {key: value, key:value}
    • HSET user name "test" address "earth"
    • HGET user name
    • Atomic operations are available on hash values too.
  • Keys can optionally follow a schema.
    • usr:123:id
    • An O(N) search is possible on a prefix of the key

Reference

Advertisements