Complete the code to run a cached Lua script using its SHA1 hash.
redis.call('[1]', sha1, 0)
The EVALSHA command runs a cached Lua script by its SHA1 hash.
Complete the code to run a cached script with 2 keys and 1 argument.
redis.call('EVALSHA', sha1, [1], key1, key2, arg1)
The argument after SHA1 in EVALSHA is the number of keys; here there are 2 keys (key1, key2).
Fix the error in the code to correctly run a cached script with no keys.
redis.call('EVALSHA', sha1, [1])
When running EVALSHA with no keys, the number of keys argument must be 0.
Fill both blanks to load a script and then run it using EVALSHA.
local sha1 = redis.call('[1]', script) redis.call('[2]', sha1, 0)
First, SCRIPT LOAD caches the script and returns its SHA1. Then EVALSHA runs the cached script by SHA1.
Fill all three blanks to load a script, then run it with 1 key and 2 arguments.
local sha1 = redis.call('[1]', script) redis.call('[2]', sha1, [3], key1, arg1, arg2)
SCRIPT LOAD caches the script and returns SHA1. EVALSHA runs it. The number 1 means one key is passed.