Complete the code to run a Lua script that returns the value of key 'mykey'.
EVAL "return redis.call('GET', [1])" 1 mykey
The Lua script needs the key name as a string, so it must be enclosed in single quotes inside the double-quoted script.
Complete the code to run a Lua script that increments the value of key 'counter' by 1.
EVAL "return redis.call('INCR', [1])" 1 counter
The key name must be a string inside the Lua script, so it needs single quotes.
Fix the error in the Lua script that returns the length of the value stored at key 'data'.
EVAL "return string.len(redis.call('GET', [1]))" 1 data
The key name must be a string literal inside the Lua script, so it needs single quotes.
Fill all three blanks to run a Lua script that sets key 'name' to 'Alice' and returns the new value.
EVAL "redis.call([1], [2], [3]); return redis.call('GET', 'name')" 1 name
The first argument to redis.call is the command 'SET' as a string, the second is the key name 'name' as a string, the third is the value 'Alice' as a string.
Fill all three blanks to run a Lua script that sets key 'age' to 30 and returns the value as a number.
EVAL "redis.call([1], [2], [3]); return tonumber(redis.call('GET', 'age'))" 1 age
The command is 'SET', the key is 'age', and the value is '30' as a string. Then the script returns the numeric value.