SCRIPT LOAD
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.
Return value
Section titled “Return value”| 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: ...andERR Unexpected flag in script shebang: ...for a bad shebang line.
Examples
Section titled “Examples”127.0.0.1:6379> SCRIPT LOAD "return redis.call('GET', KEYS[1])""d3c21d0c2b9ca22f82737626a27bcaf5d288f99f"Compatibility
Section titled “Compatibility”Same as Redis 7 and Valkey 8.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.