HLEN

Syntax
HLEN key
Available since:
Redis Open Source 2.0.0
Time complexity:
O(1)
ACL categories:
@read, @hash, @fast,
Compatibility:
Redis Enterprise and Redis Cloud compatibility

Returns the number of fields contained in the hash stored at key.

Examples

HSET myhash field1 "Hello" HSET myhash field2 "World" HLEN myhash

Redis Enterprise and Redis Cloud compatibility

Redis
Enterprise
Redis
Cloud
Notes
✅ Standard
✅ Active-Active
✅ Standard
✅ Active-Active

Return information

Integer reply: the number of fields in the hash, or 0 when the key does not exist.
RATE THIS PAGE
Back to top ↑