Easy Tutorial
❮ Scripting Script Exists Keys Expireat ❯

Redis Hexists Command

Redis Hashes

The Redis Hexists command is used to check if a specified field exists in a hash table.

Syntax

The basic syntax of the redis Hexists command is as follows:

redis 127.0.0.1:6379> HEXISTS KEY_NAME FIELD_NAME

Available Versions

= 2.0.0

Return Value

Returns 1 if the hash table contains the given field. Returns 0 if the hash table does not contain the given field, or if the 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 Hashes

❮ Scripting Script Exists Keys Expireat ❯