exists
EXISTS
Check whether a key exists
Usage: exists key [type]
Returns 1 if the key exists, 0 if it does not.
📍 type is one of string/list/set/zset/hash/stream.
The type argument was added in ent811. Please use it.
Example
| Command> | set key value |
| Result> | 1 |
| Command> | exists key string |
| Result> | 1 |
| Command> | exists xxx string |
| Result> | 0 |
| Command> | exists key list |
| Result> | 0 |
Syntax
EXISTS key [key ...] [type]
- Available since version 1.0.0.
- Time complexity is O(1).
- Since version 3.0.3 you can specify multiple keys.
- ent811 type added.