Here is an example from Redis intro:
Let's return back to the reddit.com example. A better pattern for adding submitted links (news) to the list is the following:
$ redis-cli incr next.news.id
(integer) 1
$ redis-cli set news:1:title "Redis is simple"
OK
$ redis-cli set news:1:url "http://code.google.com/p/redis"
OK
$ redis-cli lpush submitted.news 1
OK
We obtained a unique incremental ID for our news object just incrementing a key, then used this ID to create the object setting a key for every field in the object. Finally the ID of the new object was pushed on the submitted.news list.
What does next mean at the first line? Why not just incr news.id? There is no next command in Redis commands list (http://redis.io/commands).
What submitted means at the penultimate line of the code? This is something like next at the first line.
UPD:
I found a great book to understand what Redis is:
http://openmymind.net/2012/1/23/The-Little-Redis-Book/
It is short, simple but very informative.
It means absolutely nothing.
It is just a part of the next.news.id key. You can use any character in the key names including '.' which has no special meaning. You could use any other key name like sequence.news.id or increment.news.id. The only purpose of this key is to store a number that will be incremented atomically to generate news item identifiers.
Same thing for submitted.news. You could use any other name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With