HEXISTS command in redis

HEXISTS key field

This command returns 1 if the hash stored at the key contains the specified field. Return 0 if the key is not found or the field is not present.

TIME COMPLEXITY: O(1)

RETURN VALUE: Integer reply

Syntax:

HEXISTS KEY_NAME FIELD_NAME

Example 1: When the key and field are present

redis:6379> HEXISTS myhash field
(integer) 1

Output

1


Example 2: When the key and field are not present

redis:6379> HDEL myhash field1
(integer) 0

Output

0


No comments:

Post a Comment