A Redis-based distributed lock for Node.js that mirrors Java Redisson's semantics, featuring automatic watchdog renewal and unlock notifications. Version 1.0.4 (as of early 2025) is the initial stable release; the package ships TypeScript types, requires Node >=16, and declares a peer dependency on TypeScript ^5.7.2. Unlike alternatives like node-redlock, node-redisson eliminates the need to manually estimate lock hold durations or implement renewal logic. It uses ioredis under the hood for Redis connectivity.
npm install node-redissonNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Redisson instance, obtains a named lock, acquires it with auto-renewal, executes critical work, and releases the lock in a finally block.
Configure ioredis retry strategy with a maximum retry count or timeout in the Redisson options under redis.options.
Upgrade Node.js to version 16 or later.
Ensure Redis server meets the minimum version requirement based on the chosen messaging method.
Adjust the lock watchdog timeout via the 'lockWatchdogTimeout' option in Redisson config, or implement your own fallback logic.
Update instantiation to 'new Redisson({ redis: { options: { host, port } } })'.Run 'pnpm add node-redisson ioredis' (or npm/yarn equivalent).
Use 'import { Redisson } from 'node-redisson'' instead of require().Ensure you pass an object with a 'redis' property: new Redisson({ redis: { options: { ... } } }).