16.Redis STRLEN - 返回value中的字符串长度
Redis STRLEN - 语法
STRLEN key
Redis STRLEN命令,用于返回value中的字符串长度,如果value不为字符串,则返回错误。
Redis STRLEN - 时间复杂度
O(1)
Redis STRLEN - 返回值
如果value为字符串,返回其长度;否则,返回错误
Redis STRLEN - 实例演示
redis> set name "www.cregend.com"
"OK"
redis> strlen name
(integer) 15
redis> lpush domains "res.cregend.com"
(integer) 1
redis> type domains
"list"
redis> strlen domains
(error) WRONGTYPE Operation against a key holding the wrong kind of value
轻松一刻
👉👉👉 【不良人第六季】岐王女帝和幻音坊的美女们,一身武艺保家卫国,一声妖娆魅惑众生,静候不良人第七季到来~