sort large data in redis [closed]
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"
精彩评论