开发者

sort large data in redis [closed]

It's difficult to tell what is being asked here. This question is ambiguou开发者_运维技巧s, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

how to sort large data in redis?


What kind of data?

In Redis, it makes more sense to store the data in the order you want to retrieve it.

Depending on your use case you may want to look at lists or sorted sets.


You can use the ZADD and ZRANGE commands for this:

redis> zadd mySet 1 "Large data 1"
(integer) 1
redis> zadd mySet 3 "Large data 3"
(integer) 1
redis> zadd mySet 2 "Large data 2"
(integer) 1
redis> zrange mySet 0 -1
1) "Large data 1"
2) "Large data 2"
3) "Large data 3"
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜