Returns the length of a string value.
STRLEN
key
Returns the length of the string value stored at key
. An
error is returned when key
holds a non-string value.
Integer reply: the length of the string stored at key, or 0 when the key does not exist.
O(1)
@fast @read @string
127.0.0.1:6379> SET mykey "Hello world"
OK
127.0.0.1:6379> STRLEN mykey
(integer) 11
127.0.0.1:6379> STRLEN nonexisting
(integer) 0
APPEND, DECR, DECRBY, GET, GETDEL, GETEX, GETRANGE, INCR, INCRBY, INCRBYFLOAT, LCS, MGET, MSET, MSETNX, SET, SETRANGE.