can be). ‣In-Memory. Your data should fit in RAM. ‣Values are associated with unique Keys ‣Data Types: Strings, Lists, Sets, Sorted Sets, Hashes ‣Every command is Atomic ‣Keys can be segmented. Thursday, June 20, 13
Dart, Erlang, Go, Haskell, Java, Lua, Node.js, Perl, PHP, Python, Ruby, Scala (many more “unsupported” libraries) See http://redis.io/clients for more info. Thursday, June 20, 13
Write Snapshots to disk; Based on number of changes in a keys in a time period; ‣ AOF: (append-only file) writes data to disk ‣ None: ONLY stores data in memory. ‣ Both: If you really care about your data, use AOF, with periodic snapshots. Thursday, June 20, 13
query data via a Key ‣You don’t query the values ‣Keys can be anything (including binary data) ‣Smaller keys are good. ‣Define a schema: object-type:id:field Thursday, June 20, 13
couchdb nosql Updating a Set: SADD blog:11 json # would now include "couchdb", "nosql", "json" Remove an item from a set: SREM blog:11 json # removes the "json" value from the set tags for a blog entry. Thursday, June 20, 13
returns "nosql", "redis" Does an set contain a given value?: SISMEMBER blog:10 python # returns 0 or 1 Set-based operations: SUNION blog:10 blog:11 # returns "redis", "couchdb", "nosql" SINTER blog:10 blog:11 # returns "nosql" SDIFF blog:10 blog:11 # returns "redis" (in blog:10 but not blog:11) Thursday, June 20, 13
30 sally ZADD leaders 50 julie ZADD leaders 10 bill Find a rank (default ordering is low to high): ZRANK leaders bill # returns 0 Find a rank (sorted high to low): ZREVRANK leaders bill # returns 2 Thursday, June 20, 13
a message on a Channel ‣Subscribers get the message. Subscribe to a Channel called messages: SUBSCRIBE messages Publish a message: PUBLISH messages "Hello World!" Thursday, June 20, 13
a message on a Channel ‣Subscribers get the message. Subscribe to a Channel called messages: SUBSCRIBE messages Publish a message: PUBLISH messages "Hello World!" Try in multiple terminals. Thursday, June 20, 13