EVALSHA
Executes a cached Lua script identified by its SHA digest.
Lua & functions · Example verified
Syntax covered here
EVALSHA sha numkeys keyLoad the script with SCRIPT LOAD first; the case then reads one declared key using the returned digest.
Tested example & replies
Requests below run in order against an empty database. Each connection authenticates with the fixture password first. Quoted values are strings; null is a nil reply; arrays preserve RESP order.
# connection: default
> SET sample value
"OK"
# connection: default
> SCRIPT LOAD "return redis.call('GET', KEYS[1])"
"d3c21d0c2b9ca22f82737626a27bcaf5d288f99f"
# connection: default
> EVALSHA d3c21d0c2b9ca22f82737626a27bcaf5d288f99f 1 sample
"value"