HEXISTS
Since 1.1.0Hashes
Syntax
HEXISTS key fieldTells whether field exists in the hash at key. Use it to test for a field without fetching its value; when you need the value anyway, HGET answers both questions, since it returns nil for a missing field.
A field whose expiry has passed does not exist, even if it has not been removed yet. A key that does not exist counts as an empty hash, so the reply is 0, not an error. To test for the key itself, use EXISTS.
Reply
1if the field exists.0if the field does not exist, or the key does not exist.
Errors
WRONGTYPE Operation against a key holding the wrong kind of valueif the key holds something other than a hash.
Examples
> HSET u name Ada
(integer) 1
> HEXISTS u name
(integer) 1
> HEXISTS u nope
(integer) 0
> HEXISTS missing name
(integer) 0
> SET s x
OK
> HEXISTS s name
(error) WRONGTYPE Operation against a key holding the wrong kind of value