2

Lua スクリプトを redis クライアントに登録すると、次のようになります。

script = redis_client.register_script(lua_string)

次に、デフォルトのクライアントでスクリプトを実行します。

script(keys, args)

これは内部で evalsha を自動的に使用しますか、それともスクリプト全体を毎回サーバーに送信しますか?

4

1 に答える 1

5

はい。(要約)ソースコードは次のとおりです。

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)
于 2016-12-13T17:29:44.187 に答える