gpt4 book ai didi

redis - redis-py 是否自动使用 evalsha 注册脚本?

转载 作者:IT王子 更新时间:2023-10-29 06:03:33 25 4
gpt4 key购买 nike

当我向 redis 客户端注册 Lua 脚本时:

script = redis_client.register_script(lua_string)

然后使用默认客户端运行脚本:

script(keys, args)

这是自动在内部使用 evalsha 还是每次都将整个脚本发送到服务器?

最佳答案

是的。这是(删节)source code :

class Script(object):
def __call__(self, keys=[], args=[], client=None):
if isinstance(client, BasePipeline):
# Make sure the pipeline can register the script before executing.
client.scripts.add(self)

return client.evalsha(self.sha, len(keys), *args)

关于redis - redis-py 是否自动使用 evalsha 注册脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41126256/

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