Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 1.07 KB

v3-to-v4.md

File metadata and controls

35 lines (23 loc) · 1.07 KB

v3 to v4 Migration Guide

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.

Breaking Changes

See the Change Log.

Promises

Node Redis now uses native Promises by default for all functions.

Legacy Mode

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
});

createClient

The configuration object passed to createClient has changed significantly with this release. See the client configuration guide for details.