Redis can execute Lua scripts server-side — running multiple commands as a single atomic operation. Scripts enable complex atomic logic, reduce network round-trips, and are the recommended way to do multi-step atomic operations in Redis.
Running a Lua script
# EVAL runs a Lua script; KEYS[] and ARGV[] pass keys and arguments
EVAL 1 mykey myvalue
EVAL 1 lock:resource mytoken
