EXISTS

This page documents the preview (v2.21) version. Preview includes features under active development and is for development and testing only. For production, use the stable (v2024.1) version.

Single-key request only. Requests with multiple keys are not yet supported.

Synopsis

EXISTS key [key ...]

This command is a predicate to check whether or not the given key exists.

Return value

Returns the number of existing keys.

Examples

$ SET yuga1 "Africa"
"OK"
$ SET yuga2 "America"
"OK"
$ EXISTS yuga1
1
$ EXISTS yuga1 yuga2 not_a_key
2

See also

del, get, getrange, hdel, hexists, hget, hset, hincrby, sadd, set