Hashes Hlen
# Redis Hlen Command
[!(#) Redis Hashes](#)
The Redis HLEN command returns the number of fields in a hash.
### Syntax
The basic syntax of the Redis HLEN command is as follows:
redis 127.0.0.1:6379> HLEN KEY_NAME
### Available Versions
>= 2.0.0
### Return Value
The number of fields in the hash. Returns 0 when the key does not exist.
### Example
redis 127.0.0.1:6379> HSET myhash field1 "foo"(integer) 1 redis 127.0.0.1:6379> HSET myhash field2 "bar"(integer) 1 redis 127.0.0.1:6379> HLEN myhash (integer) 2
[!(#) Redis Hashes](#)
YouTip