Redis Strlen command
Redis Strlen command is used to obtain the length of the string stored key value. When the key is not stored in a string value, an error is returned.
grammar
redis Strlen basic command syntax is as follows:
redis 127.0.0.1:6379> STRLEN KEY_NAME
Available versions
> = 2.2.0
return value
The length of the string value. When the key does not exist, 0 is returned.
Examples
# 获取字符串的长度 redis> SET mykey "Hello world" OK redis> STRLEN mykey (integer) 11 # 不存在的 key 长度为 0 redis> STRLEN nonexisting (integer) 0