Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Redis Script Load Command

Redis Script Load Command

Redis Scripting

The Redis Script Load command is used to add the script to the script cache, but does not execute it immediately.

EVAL command also adds the script to the script cache, but it immediately evaluates the input script.

If the given script is already in the cache, no operation is performed.

After the script is added to the cache, via EVALSHA command, you can use the SHA1 checksum of the script to call this script.

The script can remain in the cache indefinitely until SCRIPT FLUSH is executed.

For more information about evaluating Lua scripts with Redis, please see EVAL command.

Syntax

The basic syntax of the redis Script Load command is as follows:



redis 127.0.0.1:6379> SCRIPT LOAD script

Available Version

= 2.6.0

Return Value

The SHA1 checksum of the given script

Example



redis 127.0.0.1:6379> SCRIPT LOAD "return 1"

"e0e1f9fabfc9d4800c877a703b823ac0578ff8db"

Redis Scripting