Complete the code to set a key "name" with value "Alice" in Redis using Lua.
redis.call('[1]', 'name', 'Alice')
The set command stores a value for a key in Redis. Here, it sets key "name" to "Alice".
Complete the code to increment the integer value stored at key "counter" by 1.
redis.call('[1]', 'counter')
The incr command increases the integer value of a key by 1.
Fix the error in the code to get the value of key "user".
local val = redis.call('[1]', 'user')
The get command retrieves the value of a key in Redis.
Fill both blanks to check if key "session" exists and delete it if it does.
if redis.call('[1]', 'session') == 1 then redis.call('[2]', 'session') end
exists checks if the key is present (returns 1 if yes). del deletes the key.
Fill both blanks to set key "count" to 10 only if it does not exist, then get its value.
redis.call('[1]', 'count', 10) local val = redis.call('[2]', 'count') return val
setnx sets the key only if it does not exist. get retrieves the value. set is not used here but included as a distractor.