开发者

Efficiently accessing arbitrary subsets of a master sorted set in Redis

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜