I have a sorted set, SortedSet1 = "token"=>"score"
I have a list, List1 = "token"=>"username"
Now, I want to have a record with JSON string value like-
e.g> "token"=>"{name:username, score: score}"
so that I can broadcast a leaderboard.
How to JOIN these two sets ? Or is there any chance to have JOIN of two lists or two sets ?
I have a sorted set, SortedSet1 = "token"=>"score"
I have a list, List1 = "token"=>"username"
Now, I want to have a record with JSON string value like-
e.g> "token"=>"{name:username, score: score}"
so that I can broadcast a leaderboard.
How to JOIN these two sets ? Or is there any chance to have JOIN of two lists or two sets ?
Share Improve this question asked May 9, 2013 at 4:44 PranavPranav 2,1725 gold badges27 silver badges35 bronze badges 2- Or anything like merging of lists on same keys ? – Pranav Commented May 9, 2013 at 4:47
-
where does
name
e into picture and alsoList1
look like ahash
rather thenlist
– Viren Commented May 9, 2013 at 6:13
2 Answers
Reset to default 2redis is simply a key/value store. you cannot do something like sql-joins. you need to do that by yourself (use underscore.js or lodash for merging).
there is also something that is called LUA-scripting in redis. maybe that will work for you, but i have never worked with it, so i probably cannot help you there: http://redis.io/mands/eval
Here is my approach to doing Joins in Redis. https://www.reddit./r/redis/ments/5iz0gi/joins_in_redis/ The concept is to use sorted sets as indexes, then extracting and doing intersections on the scores.