Back to Redis

HLEN

content/commands/hlen.md

latest1.0 KB
Original Source

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

Examples

{{% redis-cli %}} HSET myhash field1 "Hello" HSET myhash field2 "World" HLEN myhash {{% /redis-cli %}}

Redis Software and Redis Cloud compatibility

| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | |

Return information

{{< multitabs id="hlen-return-info" tab1="RESP2" tab2="RESP3" >}}

Integer reply: the number of fields in the hash, or 0 when the key does not exist.

-tab-sep-

Integer reply: the number of the fields in the hash, or 0 when the key does not exist.

{{< /multitabs >}}