Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
redis如何对大数据进行排序?
什么样的数据?
在 Redis 中,按照您想要检索的顺序存储数据更有意义。
根据您的用例,您可能希望查看列表或排序集。
为此,您可以使用ZADDandZRANGE命令:
ZADD
ZRANGE
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"