New issue 473 by aapo.tal...@gmail.com: Linking multiple keys to same value
http://code.google.com/p/redis/issues/detail?id=473
It would be nice if I could have several keys pointing to _same_ value (ie.
linking, just like in file systems).
For example:
SET key1 value
OK
SET key2 LINK key1
OK
GET key1
"value"
GET key2
"value"
SET key1 val
OK
GET key2
"val"
SET key2 value2
OK
GET key1
"val"
GET key2
"value2"
Makes a sense? This way I can use keys to build relations, but still have a
one place to do the updates.
Or maybe the syntax could be like this:
SET key2 LINK key1 -> LINK key1 key2
And we could even have hard links and symbolic links?
Comment #3 on issue 473 by pcnoordh...@gmail.com: Linking multiple keys to
same value
http://code.google.com/p/redis/issues/detail?id=473
It is not likely that this will be added because this would add a lot of
complexity without (at least for me) a direct gain. Can you provide a clear
use case where something like this is useful? Maybe there is another way to
model it such that having links is not necessary.
It could be useful to have more than one lookup key to reference the same
object
(for instance, some rather big python serialized object with two-three
lookup keys).
That would be awesome. I have millions of IDs identifying strings, but
there are just a few hundred strings. Being able to linking multiple keys
to same value would save me a lot of space.
One extra level of indirection solves this. For instance, instead of having:
key1 -> string1
key2 -> string1
key3 -> string1
key4 -> string2
key5 -> string2
You can have:
locator -> hash {
key1 -> id1
key2 -> id1
key3 -> id1
key4 -> id2
key5 -> id2
}
s:id1 -> string1
s:id2 -> string2
I use that kind of scheme all the time. You have to make sure to use
consistent transactions then, though.