This package provides a simple locking mechanism using Redis for Node.js applications. The current stable version is 1.0.1, released in 2012, and it is no longer maintained, with no releases in over a decade. Key features include acquire, renew, release, and check lock existence operations. The user must provide a custom value for the lock to ensure safe release by the owning host. It supports a configurable namespace and TTL but lacks promises or async/await support, being callback-based only. Unlike modern alternatives such as redlock (which offers distributed locks with automatic retry and fencing tokens), node-redis-lock is a minimal implementation intended for simpler use cases where strong consistency guarantees are not required.
npm install node-redis-lockNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Acquires and releases a Redis lock with a custom value to ensure safe ownership.
Migrate to a maintained alternative like redlock.
Use redlock which supports multiple Redis hosts and uses an algorithm that is safe under partial failure.
Check the callback result (err, result) where result is false if lock not acquired.
Always check err for connection issues, then check result for lock success.
Use new Lock(options, client); or ensure require returns the constructor.
Use an alternative package like redlock that has better Redis version compatibility.
Ensure the Redis client is kept open for the duration of lock usage; close after releasing.