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)命令

PHP and MySQL for Dynamic Web Sites : Visual QuickPro Guide

PHP and MySQL for Dynamic Web Sites : Visual QuickPro Guide

Larry Ullman / Peachpit Press / 2005 / USD 39.99

It hasn't taken Web developers long to discover that when it comes to creating dynamic, database-driven Web sites, MySQL and PHP provide a winning open source combination. Add this book to the mix, an......一起来看看 《PHP and MySQL for Dynamic Web Sites : Visual QuickPro Guide》 这本书的介绍吧!

JSON 在线解析

JSON 在线解析

在线 JSON 格式化工具

RGB转16进制工具

RGB转16进制工具

RGB HEX 互转工具

HEX HSV 转换工具

HEX HSV 转换工具

HEX HSV 互换工具