How do I delete a key from Redis using the Node.js client?

Responsive Ad Header

Question

Grade: Education Subject: Support
How do I delete a key from Redis using the Node.js client?
Asked by:
58 Viewed 58 Answers
Responsive Ad After Question

Answer (58)

Best Answer
(202)
Use the `del` command: `client.del('mykey', (err, reply) => { if (err) console.error(err); else console.log(reply); });`. The `reply` will be the number of keys that were removed (1 if 'mykey' existed).