Version 4 of Node Redis is a major refactor. While we have tried to maintain backwards compatibility where possible, several interfaces have changed. Read this guide to understand the differences and how to implement version 4 in your application.
See the Change Log.
Node Redis now uses native Promises by default for all functions.
Use legacy mode to preserve the backwards compatibility of commands while still getting access to the updated experience:
const client = createClient({
legacyMode: true
});
// legacy mode
client.set('key', 'value', 'NX', (err, reply) => {
// ...
});
// version 4 interface is still accessible
await client.v4.set('key', 'value', {
NX: true
});
The configuration object passed to createClient
has changed significantly with this release. See the client configuration guide for details.