Redis - String Strlen Command


Advertisements

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

Return Value

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

Syntax

Following is the basic syntax of Redis SETRANGE command.

redis 127.0.0.1:6379> STRLEN KEY_NAME 

Example

redis 127.0.0.1:6379> SET key1 "Hello World" 
OK 
redis 127.0.0.1:6379> STRLEN key1 
(integer) 11 
redis 127.0.0.1:6379> STRLEN key2 
(integer) 0 
redis_strings.htm
Advertisements