Redis Setnx 命令

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

Redis Setnx(SET if Not eXists) 命令在指定的 key 不存在时,为 key 设置指定的值。

语法

redis 127.0.0.1:6379> SETNX KEY_NAME VALUE

返回值

设置成功,返回 1 。 设置失败,返回 0 。

实例

127.0.0.1:6379> set domain www.codercto.com
OK
127.0.0.1:6379> setnx domain www.codercto.com.1
0
127.0.0.1:6379> setnx domain1 www.codercto.com
1

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

The Shallows

The Shallows

Nicholas Carr / W. W. Norton & Company / 2011-6-6 / USD 15.95

"Is Google making us stupid?" When Nicholas Carr posed that question, in a celebrated Atlantic Monthly cover story, he tapped into a well of anxiety about how the Internet is changing us. He also crys......一起来看看 《The Shallows》 这本书的介绍吧!

在线进制转换器

在线进制转换器

各进制数互转换器

XML 在线格式化

XML 在线格式化

在线 XML 格式化压缩工具

HEX HSV 转换工具

HEX HSV 转换工具

HEX HSV 互换工具