EXISTS(3valkey)
π 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 ifsomekeyexists,EXISTS somekey somekeywill return2. 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 π§
copy(3valkey)del(3valkey)dump(3valkey)expire(3valkey)expireat(3valkey)expiretime(3valkey)keys(3valkey)migrate(3valkey)move(3valkey)object(3valkey)object-encoding(3valkey)object-freq(3valkey)object-help(3valkey)object-idletime(3valkey)object-refcount(3valkey)persist(3valkey)pexpire(3valkey)pexpireat(3valkey)pexpiretime(3valkey)pttl(3valkey)randomkey(3valkey)rename(3valkey)renamenx(3valkey)restore(3valkey)scan(3valkey)sort(3valkey)sort_ro(3valkey)touch(3valkey)ttl(3valkey)type(3valkey)unlink(3valkey)wait(3valkey)waitaof(3valkey)
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
- 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