Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

EXISTS

Last updated
EXISTS key [key ...]
Group
Keys
Complexity
O(N) for N keys
Arity
-2 (at least 2 words, counting the command name)
Flags
read-only, fast
Keys
first 1, last final argument, step 1
HotKV Cloud
All plans
On-Premise
no license needed

EXISTS tells you whether keys exist. With several keys it returns how many of them exist, and a key named twice is counted twice. Checking a key does not count as an access to it, so it does not change the key’s idle time or access frequency.

Case RESP2 RESP3
Always Integer: the number of named keys that exist Integer
127.0.0.1:6379> SET user:1 "ada"
OK
127.0.0.1:6379> EXISTS user:1
(integer) 1
127.0.0.1:6379> EXISTS user:1 user:1 user:2
(integer) 2

Same as Redis 7 and Valkey 8.

TOUCH, TYPE, DEL, SCAN