Sunday, October 7, 2012

Go Redis! (Graph Database)

(DRAFT I SHOULD'VE POSTED BUT DIDN'T)

Redis Interactive Tutorial
My (redundant) summary:
  • Access Data
    • SET my_key "my_value"
      • "OK"
    • GET my_key 
      • (returns my_value)
  • Manipulate Data
    • DEL my_key
      • returns 1
    • INCR my_key
      • returns new value
    • SETNX my_key "my_value"
      • sets if does not exist (T/F success)
    • EXPIRE my_key time_limit_in_sec
    • TTL my_key
      • returns remaining lifespan in seconds
      • -1 if immortal
  • Basic Datatypes
    • Set
      • SADD my_set "my_value"
      • SREM my_set "my_value"
      • SMEMBERS my_set
        • lists members
      • SISMEMBER my_set "my_value"
        • T/F is a member
      • SUNION my_set my_other_set
        • union of sets, deletes non-unique entries
    • Sorted Set
      • ZADD my_set my_param "my_value"
      • ZRANGE my_set START# END#
    • List
      • LRANGE my_list #STRT #END
        • 0 to -1 gives entire list
      • LPUSH/LPOP my_list "my_value"
        • pushes/pops to end of list
      • RPUSH/RPOP my_list "my_value"
        • pushes/pops to beginning of list


No comments:

Post a Comment