Back to Redis

HSTRLEN

content/commands/hstrlen.md

latest1.3 KB
Original Source

Returns the string length of the value associated with field in the hash stored at key. If the key or the field do not exist, 0 is returned.

Examples

{{% redis-cli %}} HSET myhash f1 HelloWorld f2 99 f3 -256 HSTRLEN myhash f1 HSTRLEN myhash f2 HSTRLEN myhash f3 {{% /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="hstrlen-return-info" tab1="RESP2" tab2="RESP3" >}}

Integer reply: the string length of the value associated with the field, or zero when the field isn't present in the hash or the key doesn't exist at all.

-tab-sep-

Integer reply: the string length of the value associated with the field, or zero when the field isn't present in the hash or the key doesn't exist at all.

{{< /multitabs >}}