Ioredis: How do I use the exists command?

Created on 23 May 2016  路  5Comments  路  Source: luin/ioredis

REDIS provides the EXISTS command that returns a boolean.
ioredis' exists() command returns a method. I have tried using a callback also to no avail.
I can see in the commands page that ofcourse this command is supported but how to use this?

question

All 5 comments

The example doesn't mention the Redis command "EXISTS".

@enst There're hundreds of Redis commands available, we just can't mention all of them. However, the usages of them are similar.

@luin calling exists in a for loop, the result in callback or promise is only boolean, but how to find which key is or not exist?? Will this supply a sync way?

redis.exists('myKey').then( exists => { console.log('Does it exist?', (exists === 1)) }

Was this page helpful?
0 / 5 - 0 ratings