Simple promise-based Redis distributed lock for Node.js. Current stable version 1.0.4. Works with redis 4.x. Minimalist design: no bells, no whistles. Provides configurable retry limit, retry delay, and TTL per lock. Pure ESM with TypeScript definitions. Differentiates from alternatives (e.g., redlock) by simplicity and zero dependencies (only peer dependency on the redis client). Release cadence: low, last release 2024.
npm install redis-promise-lockNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Lock instance with a Redis client, acquires a lock, performs work, then releases the lock. Shows options and basic usage.
Use import instead of require(). Ensure your project is configured for ESM.
If you relied on no TTL, set ttl: 0 explicitly.
Pass options object as second argument. client is still required.
Prefix your lock keys with a unique identifier per application instance.
Use try/finally: try { await locker.acquireLock('lock') } finally { await locker.releaseLock('lock') }Change to import statement: import { Lock } from 'redis-promise-lock'Upgrade to redis v4 and call client.connect() before using Lock.
Increase retryLimit or retryDelay, or check that Redis is reachable and lock is not held indefinitely.
No dependency data recorded yet.