Given a large sorted set with rapidly changing scores/weights, what's the most efficient way to maintain subsets and开发者_StackOverflow社区 access those subsets in the master set's order?
You have a couple of options for this:
- Update scores in the superset and when you need to read the subset call ZINTERSTORE with subset weighting set to 0 so the result is the subset with scores from the superset.
- When updating the scores, write to the subsets as well as the superset.
The most appropriate option will depend on what you need to optimise for - read, write, memory or simplicity. How the subsets are determined and the size of the sets relative to the number of updates may also have an impact.
精彩评论