ALL COVERED TOPICS

NoSQL Benchmarks NoSQL use cases NoSQL Videos NoSQL Hybrid Solutions NoSQL Presentations Big Data Hadoop MapReduce Pig Hive Flume Oozie Sqoop HDFS ZooKeeper Cascading Cascalog BigTable Cassandra HBase Hypertable Couchbase CouchDB MongoDB OrientDB RavenDB Jackrabbit Terrastore Amazon DynamoDB Redis Riak Project Voldemort Tokyo Cabinet Kyoto Cabinet memcached Amazon SimpleDB Datomic MemcacheDB M/DB GT.M Amazon Dynamo Dynomite Mnesia Yahoo! PNUTS/Sherpa Neo4j InfoGrid Sones GraphDB InfiniteGraph AllegroGraph MarkLogic Clustrix CouchDB Case Studies MongoDB Case Studies NoSQL at Adobe NoSQL at Facebook NoSQL at Twitter

NAVIGATE MAIN CATEGORIES

Close

Redis Snippet for Storing the Social Graph

We are leaving the Twitter, Facebook days, so a couple of days ago we were looking at two examples of storing friend lists in Redis and MySQL and wondering which one is simpler. Eric Florenzano (@ericflo) shared a Gist exemplifying storing a simple social graph in Redis:

The example uses a bidirectional relationship: if A is B’s friend, then B is A’s friend. Note that due to Redis lack of transactions this code will not guarantee that both sides of the relationship are persisted. A better approach for this scenario would be using Redis MULTI/EXEC, which while not really a transaction would guarantee that both operations are performed together server side.

Original title and link for this post: Redis Snippet for Storing the Social Graph (published on the NoSQL blog: myNoSQL)