Redis - Scripting Script Load Command



Redis SCRIPT LOAD command loads a script into the scripts cache, without executing it. After the specified command is loaded into the script cache, it will be callable using EVALSHA with the correct SHA1 digest of the script, exactly like after the first successful invocation of EVAL. The script is guaranteed to stay in the script cache forever (unless SCRIPT FLUSH is called). The command works in the same way even if the script was already present in the script cache.

Syntax

Following is the basic syntax of Redis SCRIPT LOAD command.

redis 127.0.0.1:6379> SCRIPT LOAD script

Return Value

Bulk string reply - This command returns the SHA1 digest of the script added into the script cache.

Example

redis 127.0.0.1:6379> SCRIPT LOAD "return 1" 
"e0e1f9fabfc9d4800c877a703b823ac0578ff8db" 
redis_scripting.htm
Advertisements