English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis EXISTS Command

Redis Key (key)

The Redis EXISTS command is used to check if the given key exists.

Syntax

Basic Syntax of Redis EXISTS Command:

redis 127.0.0.1:6379> EXISTS KEY_NAME

Available Version

>= 1.0.0

Return Value

If the key exists, return 1 , otherwise return 0.

Online Examples

redis 127.0.0.1:6379> EXISTS w3codebox-new-key
(integer) 0

Now we create a named w3codebox-new-Set the key and assign a value, and then use the EXISTS command.

redis 127.0.0.1:6379> set w3codebox-new-key newkey
OK
redis 127.0.0.1:6379> EXISTS w3codebox-new-key
(integer) 1
redis 127.0.0.1:6379>

Redis Key (key)