SCRIPT EXISTS · Valkey

SCRIPT EXISTS

Determines whether server-side Lua scripts exist in the script cache.

Usage

SCRIPT EXISTS sha1 [sha1…]

Description

Returns information about the existence of the scripts in the script cache.

This command accepts one or more SHA1 digests and returns a list of ones or zeros to signal if the scripts are already defined or not inside the script cache. This can be useful before a pipelining operation to ensure that scripts are loaded (and if not, to load them using SCRIPT LOAD) so that the pipelining operation can be performed solely using EVALSHA instead of EVAL to save bandwidth.

For more information about EVAL scripts please refer to Introduction to Eval Scripts.

Reply

Array reply: an array of integers that correspond to the specified SHA1 digest arguments.

Complexity

O(N) with N being the number of scripts to check (so checking a single script is an O(1) operation).

ACL Categories

@scripting @slow

History

See also

EVAL, EVALSHA, EVALSHA_RO, EVAL_RO, FCALL, FCALL_RO, FUNCTION, FUNCTION DELETE, FUNCTION DUMP, FUNCTION FLUSH, FUNCTION HELP, FUNCTION KILL, FUNCTION LIST, FUNCTION LOAD, FUNCTION RESTORE, FUNCTION STATS, SCRIPT, SCRIPT DEBUG, SCRIPT FLUSH, SCRIPT HELP, SCRIPT KILL, SCRIPT LOAD, SCRIPT SHOW.