SCRIPT-EXISTS(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

✨ 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:


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