English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Hexists Command

Redis Hashes (Hash)

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

Syntax

Basic Syntax of redis Hexists Command:

redis 127.0.0.1:6379> HEXISTS KEY_NAME FIELD_NAME

Available Version

=> 2.0.0

Return Value

If the hash table contains the specified field, return 1 . If the hash table does not contain the specified field, or the key does not exist, return 0.

Online Examples

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 (Hash)