A distributed locking library for NestJS using a single Redis instance. Version 1.0.1 provides a simple lock/unlock API and a decorator-based approach for automatic locking around method execution. It offers configurable lock duration, retry interval, and max retries. Requires the 'nestjs-redis' package as a peer dependency and integrates with NestJS's module system. Compared to alternatives like 'redis-semaphore' or 'redlock', this package focuses on simplicity and tight NestJS integration with minimal configuration.
npm install nestjs-simple-redis-lockNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows importing RedisLockModule, injecting RedisLockService, and using lock/unlock in a service.
Ensure RedisModule.forRoot/forAsync is imported before RedisLockModule.register.
Call await this.lockService.unlock('name') after critical section.Remove await from lock() and setTTL() calls.
Ensure the decorated method returns the desired value.
Import RedisModule before RedisLockModule in the same module imports array.
Use constructor injection and ensure RedisLockModule.register is called.
Use 'import { RedisLockService } from 'nestjs-simple-redis-lock';'