Redis Strlen 命令

Redis 教程 · 2019-03-07 06:12:02

Redis Strlen 命令用于获取指定 key 所储存的字符串值的长度。当 key 储存的不是字符串值时,返回一个错误。

语法

redis Strlen 命令基本语法如下:

redis 127.0.0.1:6379> STRLEN KEY_NAME

可用版本

>= 2.2.0

返回值

字符串值的长度。 当 key 不存在时,返回 0。

实例

# 获取字符串的长度

redis> SET mykey "Hello world"
OK

redis> STRLEN mykey
(integer) 11


# 不存在的 key 长度为 0

redis> STRLEN nonexisting
(integer) 0

点击查看所有 Redis 教程 文章: https://codercto.com/courses/l/33.html

查看所有标签

Building Social Web Applications

Building Social Web Applications

Gavin Bell / O'Reilly Media / 2009-10-1 / USD 34.99

Building a social web application that attracts and retains regular visitors, and gets them to interact, isn't easy to do. This book walks you through the tough questions you'll face if you're to crea......一起来看看 《Building Social Web Applications》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

MD5 加密
MD5 加密

MD5 加密工具