EXISTS
Syntax
EXISTS key [key ...]
- Available since:
- 1.0.0
- Time complexity:
- O(N) where N is the number of keys to check.
- ACL categories:
-
@keyspace
,@read
,@fast
,
如果key
存在则返回。
用户应该注意,如果在参数中多次提到相同的现有键,它将被多次计数。因此,如果somekey
存在,EXISTS somekey somekey
将返回2。
示例
RESP2/RESP3 回复
Integer reply: the number of keys that exist from those specified as arguments.历史
- 从 Redis 版本 3.0.3 开始:接受多个
key
参数。