当我将Lua脚本注册到redis客户端时:
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/