w3resource

Redis String: STRLEN key

STRLEN key

Redis STRLEN command is used to get the length of the string value stored at key. An error is returned when key holds a non-string value.

Syntax:

redis 127.0.0.1:6379> STRLEN KEY_NAME

Available since

2.2.0.

Return Value

Integer reply, the length of the string at the key, or 0 when the key does not exist.

Return Value Type

Integer

Example: Redis STRLEN

redis 127.0.0.1:6379> SET key1 "Redis"
OK
redis 127.0.0.1:6379>  STRLEN key1
(integer) 5

Previous: SETRANGE
Next: MSET



Follow us on Facebook and Twitter for latest update.