Redis Get 命令

更新时间: 2019-07-07 15:54

Redis Get 命令用于获取指定 key 的值。如果 key 不存在,返回 nil 。如果key 储存的值不是字符串类型,返回一个错误。

语法

redis 127.0.0.1:6379> GET KEY_NAME

返回值

返回 key 的值,如果 key 不存在时,返回 nil。 如果 key 不是字符串类型,那么返回一个错误。

实例

实例1: key 存在

127.0.0.1:6379> exists domain
(integer) 1
127.0.0.1:6379> get domain
"www.codercto.com_new"

实例2: key 不存在

127.0.0.1:6379> exists domain
(integer) 0
127.0.0.1:6379> get domain
(nil)

实例3: key 不是字符串类型

127.0.0.1:6379> lpush domain_list www.codercto.com
(integer) 1
127.0.0.1:6379> get domain_list
(error) WRONGTYPE Operation against a key holding the wrong kind of value

查看更多 Redis 字符串(String)命令

Dive Into Python 3

Dive Into Python 3

Mark Pilgrim / Apress / 2009-11-6 / USD 44.99

Mark Pilgrim's Dive Into Python 3 is a hands-on guide to Python 3 (the latest version of the Python language) and its differences from Python 2. As in the original book, Dive Into Python, each chapter......一起来看看 《Dive Into Python 3》 这本书的介绍吧!

JSON 在线解析

JSON 在线解析

在线 JSON 格式化工具

在线进制转换器

在线进制转换器

各进制数互转换器

HSV CMYK 转换工具

HSV CMYK 转换工具

HSV CMYK互换工具