SCRIPT-EXISTS(3valkey)
β¨ SCRIPT-EXISTS β the "do u even go here?" check for ur Lua scripts π
okay so this is a page from the Valkey Command Manual, and it's all about SCRIPT-EXISTS(3valkey), bestie. buckle up, it's short but it's iconic.
πΈ NAME πΈ
script-exists β literally just checks whether ur server-side Lua scripts exist in the script cache. that's it. that's the whole job. and she does it flawlessly. π
π SYNOPSIS π
SCRIPT EXISTS sha1 [sha1...]
one or more SHA1 digests, one command. very demure, very mindful. β¨
π DESCRIPTION π
so basically this command returns info about whether scripts are chillin' in the script cache or not.
it takes one or more SHA1 digests and hands u back a list of ones and zeros β 1 means "yep, she's already defined in the script cache π«Ά", 0 means "nope, never seen her π". a lil vibe check, if u will.
why do u care? bc this is the move before a pipelining operation, fr fr. u check first to make sure the scripts are loaded β and if they're not, u load them with valkey-script-load(7) SCRIPT LOAD β so that the pipelining operation can go off using only valkey-evalsha(7) EVALSHA instead of valkey-eval(7) EVAL, which saves u bandwidth. saving bandwidth is self-care, periodt. π
want the full lore on EVAL scripts? go read valkey-eval-intro(7) Introduction to Eval Scripts. it's giving required reading. π
π¦ REPLY π¦
valkey-protocol(7) Array reply: an array of integers that correspond to the specified SHA1 digest arguments. so like, one integer per sha1 u asked about, in order. no cap. π₯
π COMPLEXITY π
O(N) where N is the number of scripts to check β so checking a single script is an O(1) operation. she scales, bestie. β
π ACL CATEGORIES π
@scripting@slow
iykyk. π
π§ HISTORY π§
- Available since:
2.6.0β an OG, honestly. she's been serving since forever. π
πΈ SEE ALSO πΈ
go give these queens some love too:
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)
okay that's the whole page, and omg u read it all, ur literally the main character. π«Ά this lil masterpiece is from Valkey 9.0.0, dated 2025-10-21, and it lives under the name SCRIPT-EXISTS(3valkey). mwah, bye bestie πβ¨
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms