How to delete everything in node redis?

Nelson picture Nelson · Jun 16, 2016 · Viewed 23.9k times · Source

I want to be able to delete all the keys. Is there a way to flush all in node redis?

Redis client:

client = redis.createClient(REDIS_PORT, REDIS_HOST);

Answer

MikeJannino picture MikeJannino · Jun 16, 2016

Perhaps flushdb or flushall are options that you can look into.

In Node, with the client, these look like this:

client.flushdb( function (err, succeeded) {
    console.log(succeeded); // will be true if successfull
});