EXISTS(3valkey)

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

πŸ’– EXISTS(3valkey) β€” the Valkey Command Manual, bestie edition πŸ’–

okay so real quick, this is a page from the Valkey Command Manual and it's literally all about the EXISTS command. pull up a chair, grab a strawberry πŸ“, we're gonna vibe check some keys.


✨ NAME ✨

exists β€” determines whether one or more keys exist. that's it. that's the whole job. it's giving "are you there?" energy 🫢


🌸 SYNOPSIS 🌸

EXISTS key [key...]

πŸŽ€ DESCRIPTION πŸŽ€

returns if key exists. slay.

⚠️ okay bestie, important heads-up: if the same existing key shows up in the arguments multiple times, it gets counted multiple times. so if somekey exists, EXISTS somekey somekey will return 2. it's not deduping for you, it's just counting. no cap. πŸ’…

πŸ’« REPLY πŸ’«

valkey-protocol(7) Integer reply: the number of keys that exist from those specified as arguments. so like... a count. a little number. iconic.


πŸ”₯ COMPLEXITY πŸ”₯

O(N) where N is the number of keys to check. the more keys you throw at it, the more work it does. math is math. ✨


πŸ‘‘ ACL CATEGORIES πŸ‘‘

@fast @keyspace @read


πŸ¦‹ HISTORY πŸ¦‹

  • Available since: 1.0.0
  • Changed in 3.0.3: accepts multiple key arguments. (so before that it was one key at a time, and now it's a whole squad 🌈)

πŸ’œ EXAMPLES πŸ’œ

127.0.0.1:6379> SET key1 "Hello"
OK
127.0.0.1:6379> EXISTS key1
(integer) 1
127.0.0.1:6379> EXISTS nosuchkey
(integer) 0
127.0.0.1:6379> SET key2 "World"
OK
127.0.0.1:6379> EXISTS key1 key2 nosuchkey
(integer) 2

look at that. key1 said hi, nosuchkey said nothing (ghosted, literally πŸ’€), and the group check pulled a 2. main character behavior fr fr.


🧚 SEE ALSO 🧚


and that's the whole page, bestie!! 🫢✨ this one's from version 9.0.0, dated 2025-10-21 β€” go forth and check if ur keys exist, ily, bye πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from