Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

SCRIPT LOAD

Last updated
SCRIPT LOAD script
Group
Scripting and functions
Complexity
O(N) where N is the length of the script
Arity
3 (exactly, counting the command name)
HotKV Cloud
All plans
On-Premise
no license needed

SCRIPT LOAD compiles script, stores it in the script cache and returns its SHA1 digest, which you then pass to EVALSHA. Loading the same text again returns the same digest. Scripts loaded this way stay cached until SCRIPT FLUSH or a restart.

Case RESP2 RESP3
Compiled Bulk string: the 40-character hexadecimal SHA1 digest Bulk string

Errors:

  • ERR Error compiling script (new function): ... when the script does not compile.
  • ERR Invalid script shebang, ERR Unknown lua shebang option: ... and ERR Unexpected flag in script shebang: ... for a bad shebang line.
127.0.0.1:6379> SCRIPT LOAD "return redis.call('GET', KEYS[1])"
"d3c21d0c2b9ca22f82737626a27bcaf5d288f99f"

Same as Redis 7 and Valkey 8.

EVALSHA, SCRIPT EXISTS, SCRIPT FLUSH