Noob Tutorial -- Learning not just technology, but also dreams!
Redis Tutorial
Redis Commands
Advanced Redis Tutorials
Redis EXISTS Command
The Redis EXISTS command is used to check whether a given key exists.
Syntax
The basic syntax for the Redis EXISTS command is as follows:
redis 127.0.0.1:6379> EXISTS KEY_NAME
Available Version
>= 1.0.0
Return Value
Returns 1 if the key exists, otherwise returns 0.
Example
redis 127.0.0.1:6379> EXISTS -new-key (integer) 0
Now we create a key named -new-key and assign it a value, then use the EXISTS command again.
redis 127.0.0.1:6379> set -new-key newkey OK redis 127.0.0.1:6379> EXISTS -new-key (integer) 1 redis 127.0.0.1:6379>
YouTip