gpt4 book ai didi

redis - 使用 Redis Cluster,是否可以将散列标签传递给 eval?

转载 作者:IT王子 更新时间:2023-10-29 06:09:30 26 4
gpt4 key购买 nike

来自Redis documentation on eval它说:

should not represent key names

Redis cluster tutorial

Hash tags are documented in the Redis Cluster specification, but the gist is that if there is a substring between {} brackets in a key, only what is inside the string is hashed, so for example this{foo}key and another{foo}key are guaranteed to be in the same hash slot, and can be used together in a command with multiple keys as arguments.

是否可以只传递散列标签或者只传递一个带有该散列标签的键?我们希望 eval 的内容与由另一个键的内容确定的一组动态键一起工作,但每个键都属于同一个散列标签。

最佳答案

是的,应该有效。

the documentation 中所述:

All Redis commands must be analyzed before execution to determine which keys the command will operate on.... Note this rule is not enforced in order to provide the user with opportunities to abuse the Redis single instance configuration, at the cost of writing scripts not compatible with Redis Cluster.

所以不遵守这个规则也没关系,只要你保证你的脚本兼容Redis Cluster即可。这意味着对 EVAL 的调用应该指定一组散列到一个且仅一个服务器的 key 。

只需使用一个键(例如 {foo})就可以正常工作。

关于redis - 使用 Redis Cluster,是否可以将散列标签传递给 eval?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49926357/

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