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
Redis Software and Redis Cloud compatibility
| Redis Enterprise |
Redis Cloud |
Notes |
|---|---|---|
| ✅ Standard |
✅ Standard |
Return information
Integer reply: the length of the string stored at key, or 0 when the key does not exist.