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


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: