English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Redis EXISTS command is used to check if the given key exists.
Basic Syntax of Redis EXISTS Command:
redis 127.0.0.1:6379> EXISTS KEY_NAME
>= 1.0.0
If the key exists, return 1 , otherwise return 0.
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>