Introduction
You use keys and arguments to tell Redis exactly which data to work with and what extra information to use.
EVAL script numkeys key [key ...] arg [arg ...]
EVAL "return redis.call('GET', KEYS[1])" 1 mykey
EVAL "return {KEYS[1], ARGV[1]}" 1 key1 value1
EVAL "redis.call('SET', KEYS[1], ARGV[1])" 1 mykey newvalue
EVAL "return {KEYS[1], KEYS[2], ARGV[1], ARGV[2]}" 2 keyA keyB arg1 arg2
local key1 = KEYS[1] local arg1 = ARGV[1] return key1 .. '-' .. arg1If the script is called with keys = ["user:1"] and arguments = ["active"], what is the returned result?
local key = KEYS[1] local arg = ARGV[0] return key .. argWhen running the script with one key and one argument, what will happen?
Pass the test and this pattern moves unknown