Reputation: 373
I want to display leaders board for the users who are earning more points from two different games.
I am storing user scores as per games using redis's sorted sets, How I can get intersect on these games sorted sets to display common leaderborad.
Upvotes: 1
Views: 455
Reputation: 49942
This sounds like a job for ZINTERSTORE
:
ZINTERSTORE leaders-sorted-set 2 game-1-sorted-set game-2-sorted-set AGGREGATE SUM
Since there is no AVG
aggregate subcommand, you'll have to divide the resultant scores to obtain that.
Upvotes: 3