SCRIPT

Loads scripts, checks their presence, or clears the script cache.

Lua & functions · Example verified

Syntax covered here

SCRIPT LOAD script | SCRIPT EXISTS sha | SCRIPT FLUSH

EXISTS confirms the loaded digest is present and becomes absent after FLUSH; cached invocations therefore depend on cache lifecycle.

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
> SCRIPT LOAD "return redis.call('GET', KEYS[1])"
"d3c21d0c2b9ca22f82737626a27bcaf5d288f99f"
# connection: default
> SCRIPT EXISTS d3c21d0c2b9ca22f82737626a27bcaf5d288f99f
[1]
# connection: default
> SCRIPT FLUSH
"OK"
# connection: default
> SCRIPT EXISTS d3c21d0c2b9ca22f82737626a27bcaf5d288f99f
[0]