Latest web development tutorials

Redis Hexists command

Redis hash (Hash)

Redis Hexists specified field command is used to view the hash table exists.

grammar

redis Hexists basic command syntax is as follows:

redis 127.0.0.1:6379> HEXISTS KEY_NAME FIELD_NAME 

Available versions

> = 2.0.0

return value

If the hash table containing a given field, returns 1. If the hash table does not contain a given field, or key does not exist, 0 is returned.

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