Redis EXISTS 命令

Redis 教程 · 2019-03-06 18:12:52

Redis EXISTS 命令用于检查给定 key 是否存在。

语法

redis EXISTS 命令基本语法如下:

redis 127.0.0.1:6379> EXISTS KEY_NAME

可用版本

>= 1.0.0

返回值

若 key 存在返回 1 ,否则返回 0 。

实例

redis 127.0.0.1:6379> EXISTS codercto-new-key
(integer) 0

现在我们创建一个名为 codercto-new-key 的键并赋值,再使用 EXISTS 命令。

redis 127.0.0.1:6379> set codercto-new-key newkey
OK
redis 127.0.0.1:6379> EXISTS codercto-new-key
(integer) 1
redis 127.0.0.1:6379>

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

查看所有标签

Beautiful Code

Beautiful Code

Greg Wilson、Andy Oram / O'Reilly Media / 2007-7-6 / GBP 35.99

In this unique work, leading computer scientists discuss how they found unusual, carefully designed solutions to difficult problems. This book lets the reader look over the shoulder of major coding an......一起来看看 《Beautiful Code》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

随机密码生成器
随机密码生成器

多种字符组合密码