EXISTS

Posted winnerren

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了EXISTS相关的知识,希望对你有一定的参考价值。

EXISTS key

检查给定key是否存在。

版本:>=1.0.0

时间复杂度:O(1)

返回值:

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

案例:

127.0.0.1:6379> SET db "winner"
OK
127.0.0.1:6379> EXISTS db
(integer) 1
127.0.0.1:6379> DEL db
(integer) 1
127.0.0.1:6379> EXISTS db
(integer) 0

 

以上是关于EXISTS的主要内容,如果未能解决你的问题,请参考以下文章