Can I use redis as the only DB to power a small/medium social site with user profiles?
Is it possible?...Would it be a good idea?
Would all my user's information have to be stored in a single dictionary object, and then retrieve that information by key?
FAQ:
Q: Why not MongoDB? Cassandra? CouchDB?
A: I like Redis for 开发者_开发百科it's simplicity and ease of use. All other NoSQL databases just seem like there's a lot to learn. But I should use the right tool for job right? Yes, when you are proficient at using many tools, then you can decide which tool is better suited for a specific task. http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis . I don't have any experience with either RDBMS or NoSql, so I've got to start somewhere right.
Redis works quite nicely in this scenario - the set functionality is particularly useful when you need to model connections between users.
You have three basic options for storing the user profile:
- Single key containing a serialized object - simplest if you generally need all properties at once.
- Redis hash for each user with a subkey for each property - a popular approach, though not one I like personally
- Multiple keys for each user - less efficient in some cases, but allows you to use complex data structures for property values
You can also use a combination of these approaches - my own system uses a single json string for the basic properties and additional keys for the properties that are better implemented as sets.
精彩评论