34

I've recently been getting into Redis and find it very appealing. I'd like to see how far I can push it's limits as a database. I read the Retwis tutorial and found it very interesting. I'm wondering if there are even more resources that give examples of data modeling in Redis? Perhaps something along the lines of a cookbook?

Thanks!

EDIT

So here are some links I've found so far. I'd really like to know some more:

1

3 Answers 3

6

There is a catch in what you ask for: it all depends on your data.

Fundamentally Redis is a data structure server. How you structure your data depends almost entirely on what it is and how you need to access it. The simple and common cases are fairly well covered by the links you list.

Designing for Redis in my experience is more along the lines of "how simple is my structure?". Can you model your data via hash? If so, use the hash commands in Redis. Do you need to combine sets and key-values or hashes? Then do it the same in redis. Essentially, assume you were not using a database. If you did it entirely within your programming language and in memory, how would you model your data? Odds are that is how you'd do it in Redis - or close enough to figure the rest out.

That isn't to say that specific usage patterns will not emerge. I think they are starting to. For example a common question is about web access log storage/calculation and there are common patterns coming out of those efforts. Yet there again I expect them to essentially mirror in-memory structures common to programming languages such as hashes, sets, ordered sets, lists, key-value (ie. the variable), and atomic counters. Further, most will be specific to the program being written. I suspect that is why the cookbook is still sparse (that and it is still early).

I'd suggest joining the redis list and discussing particular needs there.

5

Here are a two more resources that could be helpful for Redis data modeling:

0
1

I would give the Redis Docs a read (redis.io). They provide some very useful incites into using redis, and working with different kinds of data. Even reading the FAQ will tell you stuff that will come in useful (or it did for me). The way I learned is just to try and replicate mysql software in using redis. It makes you think outside the box.

Not the answer you're looking for? Browse other questions tagged or ask your own question.