gpt4 book ai didi

redis - 将 key 存储在 redis 集中

转载 作者:可可西里 更新时间:2023-11-01 11:23:15 24 4
gpt4 key购买 nike

我刚开始使用 redis,我想检索键值对的一部分(例如 SELECTfind)。
我的计划是将相关的 key 保存在一个集合中。因此,我将使用 SMEMBERS,获取 key ,然后对每个元素使用 MGET

这是实现我的目标的正确方法还是有更好的内置机制?

谢谢。

最佳答案

Yes, that's the basic approach to "indexing" in Redis. If your set is large, you'd want to use SSCAN instead of SMEMBERS. Also, don't use a single MGET for everything, but rather make batches of constant size (e.g. 100). These two methods will allow better concurrency.

– 伊塔马尔·哈伯

关于redis - 将 key 存储在 redis 集中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57521115/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com