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

Implementing a Social Graph using Redis

We’ve seen before a Redis snippet for storing the social graph, this one in PHP:

The trick to implementing the social graph is using the built-in Set datatype in Redis.  In short, a set is an unordered collection of binary-safe strings. These strings are grouped together using a key as the index.  The great thing about sets is that the most used operations are performed in O(1) (constant) time.  More complex operations have slightly worse runtimes, such as determining common followers among a set of users, which runs in O(n * m).

As regards those “more complex operations, you might want to check the Redis SINTER/set intersection performance.

Original title and link: Implementing a Social Graph using Redis (NoSQL databases © myNoSQL)

via: http://blog.meltingice.net/programming/implementing-social-graph-redis/