script-exists.3valkey - Man Page

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

Synopsis

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 valkey-script-load(7) SCRIPT LOAD) so that the pipelining operation can be performed solely using valkey-evalsha(7) EVALSHA instead of valkey-eval(7) EVAL to save bandwidth.

For more information about EVAL scripts please refer to valkey-eval-intro(7) Introduction to Eval Scripts.

Reply

valkey-protocol(7) 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(3valkey), evalsha(3valkey), evalsha_ro(3valkey), eval_ro(3valkey), fcall(3valkey), fcall_ro(3valkey), function(3valkey), function-delete(3valkey), function-dump(3valkey), function-flush(3valkey), function-help(3valkey), function-kill(3valkey), function-list(3valkey), function-load(3valkey), function-restore(3valkey), function-stats(3valkey), script(3valkey), script-debug(3valkey), script-flush(3valkey), script-help(3valkey), script-kill(3valkey), script-load(3valkey), script-show(3valkey)

Info

2025-10-21 9.0.0 Valkey Command Manual