HEXISTS(3valkey)
π HEXISTS(3valkey) β the Valkey Command Manual, bestie edition π
okay so bestie, welcome to hexists, from the Valkey command manual. yes it's a whole manual page, no it's not boring, sit down, hydrate, let's go π«Ά
β¨ NAME β¨
hexists β determines whether a field exists in a hash. that's it. that's the whole job. she's a yes/no girlie and she's iconic for it π
π SYNOPSIS π
HEXISTS key field
two little arguments, zero drama. key and field, in that order, periodt.
πΈ DESCRIPTION πΈ
so basically: this command tells you if field is an existing field in the hash stored at key. that's the vibe check. does the field live there or not. no cap. β¨
she does not return the value. she does not judge the value. she just confirms existence. main character energy of presence π¦
π REPLY π
you get back one of these, and only these:
- valkey-protocol(7) Integer reply:
0if the hash does not contain the field, or the key does not exist. - valkey-protocol(7) Integer reply:
1if the hash contains the field.
so it's a 0 or a 1, and that's the whole personality. 0 = not it. 1 = slay, she's there π
heads up bestie: missing field and missing key both give you the same 0. don't come for her about it, that's just how it is π
π₯ COMPLEXITY π₯
constant time. instant. lightning. she does not scroll, she does not search, she just knows β
π ACL CATEGORIES π
@fast@hash@read
fast, hash-flavoured, and read-only. a respectful queen π
π¦ HISTORY π¦
- Available since:
2.0.0
she's been here since 2.0.0. veteran. legend. ate and left no crumbs π
β EXAMPLES β
here's her in her natural habitat:
127.0.0.1:6379> HSET myhash field1 "foo"
(integer) 1
127.0.0.1:6379> HEXISTS myhash field1
(integer) 1
127.0.0.1:6379> HEXISTS myhash field2
(integer) 0
see how field1 gets a 1 and field2 gets a 0? that's the whole arc. character development, honestly ππ
π SEE ALSO π
the whole hash friend group, all of them, no one left out:
hdel(3valkey),hexpire(3valkey),hexpireat(3valkey),hexpiretime(3valkey),hget(3valkey),hgetall(3valkey),hgetex(3valkey),hincrby(3valkey),hincrbyfloat(3valkey),hkeys(3valkey),hlen(3valkey),hmget(3valkey),hmset(3valkey),hpersist(3valkey),hpexpire(3valkey),hpexpireat(3valkey),hpexpiretime(3valkey),hpttl(3valkey),hrandfield(3valkey),hscan(3valkey),hset(3valkey),hsetex(3valkey),hsetnx(3valkey),hstrlen(3valkey),httl(3valkey),hvals(3valkey)
and that's the page, bestie!! πβ¨ this one's from Valkey version 9.0.0, dated 2025-10-21 β so if you're reading this, hi, ily, go check your hashes, and remember: if HEXISTS says 1, you ate. if it says 0... we move π«ΆπΈπ
π¦ 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