This repository has been archived by the owner on May 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
EXISTS
Josh Baker edited this page Oct 11, 2016
·
8 revisions
Returns if key exists.
The user should be aware that if the same existing key is mentioned in the arguments multiple times, it will be counted multiple times. So if somekey exists, EXISTS somekey somekey
will return 2.
Integer reply, specifically:
- 1 if the key exists.
- 0 if the key does not exist.
> SET key1 "Hello"
OK
> EXISTS key1
(integer) 1
> EXISTS nosuchkey
(integer) 0
> SET key2 "World"
OK
> EXISTS key1 key2 nosuchkey
(integer) 2
APPEND, BITCOUNT, BITOP, BITPOS, DBSIZE, DECR, DECRBY, DEL, EXISTS, EXPIRE, EXPIREAT, FLUSHDB, GET, GETBIT, GETRANGE, GETSET, INCR, INCRBY, INCRBYFLOAT, KEYS, MGET, MSET, MSETNX, PDEL, PERSIST, PEXPIRE, PEXPIREAT, PTTL, RENAME, RENAMENX, SET, SETBIT, SETRANGE, STRLEN, TTL