Redis Hexists Command
The Redis Hexists command is used to check whether the specified field exists in the hash.
Syntax
The basic syntax of the redis Hexists command is as follows:
redis 127.0.0.1:6379> HEXISTS KEY_NAME FIELD_NAME
Available Version
= 2.0.0
Return Value
Returns 1 if the hash contains the given field. Returns 0 if the hash does not contain the given field, or if key does not exist.
Example
redis 127.0.0.1:6379> HSET myhash field1 "foo"
(integer) 1
redis 127.0.0.1:6379> HEXISTS myhash field1
(integer) 1
redis 127.0.0.1:6379> HEXISTS myhash field2
(integer) 0
Redis Hash