EXISTS

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Check whether a key exists

Usage: exists key [type]
Returns 1 if the key exists, 0 if it does not.
📍 type is one of string/list/set/zset/hash/stream.
      The type argument was added in ent811. Please use it.

Example

Command>set key value
Result>1
Command>exists key string
Result>1
Command>exists xxx string
Result>0
Command>exists key list
Result>0

Syntax

EXISTS key [key ...] [type]

  • Available since version 1.0.0.
  • Time complexity is O(1).
  • Since version 3.0.3 you can specify multiple keys.
  • ent811 type added.
Related commands KEYS, TYPE, SISMEMBER, HEXISTS
Clients for Java Jedis, Lettuce, Redisson
Clients for C Hiredis

<< COMMON Introduction EXISTS UNLINK >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.