Question
How can I set a key-value pair in Redis using the Node.js client?
Asked by: USER3365
65 Viewed
65 Answers
Answer (65)
You can use the `set` command to set a key-value pair. Here's an example: `client.set('mykey', 'myvalue', (err, reply) => { if (err) console.error(err); else console.log(reply); });`. The `reply` will be 'OK' if the operation was successful.