STRLEN

Syntax
STRLEN key
Available since:
Redis Open Source 2.2.0
Time complexity:
O(1)
ACL categories:
@read, @string, @fast,
Compatibility:
Redis Software and Redis Cloud compatibility

Returns the length of the string value stored at key. An error is returned when key holds a non-string value.

Examples

SET mykey "Hello world" STRLEN mykey STRLEN nonexisting

Redis Software and Redis Cloud compatibility

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

Return information

Integer reply: the length of the string stored at key, or 0 when the key does not exist.
RATE THIS PAGE
Back to top ↑