Easy Tutorial
❮ Keys Pexpireat Sorted Sets Zunionstore ❯

Redis Script Load Command

Redis Scripting

The Redis Script Load command is used to add the script to the script cache without executing it immediately.

The 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, it can be invoked using its SHA1 checksum via the EVALSHA command.

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

For more information on evaluating Lua scripts with Redis, see the 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 Versions

= 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

❮ Keys Pexpireat Sorted Sets Zunionstore ❯