开发者

sort large data in redis [closed]

开发者 https://www.devze.com 2023-01-05 08:54 出处:网络
It's difficult to tell what is being asked here. This question is ambiguou开发者_运维技巧s, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form.
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

精彩评论

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

关注公众号