evalSha

PHP Redis

evalSha

Description

Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself. In order to run this command Redis will have to have already loaded the script, either by running it or via the SCRIPT LOAD command.

Parameters

script_sha string. The sha1 encoded hash of the script you want to run.
args array, optional. Arguments to pass to the LUA script.
num_keys int, optional. The number of arguments that should go into the KEYS array, vs. the ARGV array when Redis spins the script

Return value

Mixed. See EVAL

Examples
$script = 'return 1';
$sha = $redis->script('load', $script);
$redis->evalSha($sha); // Returns 1