In this tutorial, we will learn about how to check, if a key exists in redis datastore or not by using a COMMAND – EXISTS in redis-cli. The syntax of redis EXISTS command is as follows :-
Syntax :-
redis host:post> EXISTS <key name>
Output :-
- 1 if key exist - 0 if key does not exist
Example :-
References :-
- EXISTS Command Docs
That’s all for how to check existence of key in redis datastore. If you liked it, please share your thoughts in comments section and share it with others too.