H13-711_V3.5 · Question #392
Redis judges whether a key exists using the exist command.
The correct answer is A. True. A is correct because Redis provides the EXISTS command to check whether one or more keys are present in the database. It returns an integer - 1 if the key exists, 0 if it does not - making it the standard and idiomatic way to test key presence in Redis. B is incorrect because…
Question
Redis judges whether a key exists using the exist command.
Options
- ATrue
- BFalse
How the community answered
(55 responses)- A73% (40)
- B27% (15)
Explanation
A is correct because Redis provides the EXISTS command to check whether one or more keys are present in the database. It returns an integer - 1 if the key exists, 0 if it does not - making it the standard and idiomatic way to test key presence in Redis.
B is incorrect because there is no ambiguity here: EXISTS is a real, documented Redis command and has been part of Redis since version 1.0. There is no alternative command that replaces it for this purpose.
Memory tip: Think of EXISTS as Redis's version of a lookup before you leap - just like checking if key in dict in Python, EXISTS mykey tells you whether something is there before you try to use it.
Topics
Community Discussion
No community discussion yet for this question.