How nomad-bank/nestjs-simple-redis-lock works
This NestJS library provides distributed locking through a single Redis instance. An application registers the lock module with Redis options, then calls the injected service or wraps a method with the decorator; the service acquires, renews, and releases locks in Redis. The graph includes configuration and the service’s options/token layer. The README documents Nest Redis setup and decorator behavior; source excerpts show the lock operations and module wiring.
Main entry points: redisLock.service.ts Lock Service · redisLock.module.ts Lock Module · redisLock.decorator.ts Lock Decorator · redisLockOptions.interface.ts Lock Options
Components 7
Module Configuration
- Lock Module
lib/redisLock.module.ts - Lock Options
lib/interfaces/redisLockOptions.interface.ts - Options Token
lib/redisLock.constants.ts
Lock Runtime
- Lock Service
lib/redisLock.service.ts
Application API
- Lock Decorator
lib/redisLock.decorator.ts
Other components
- Nest Application
- Redis Instance
Connections 10
- Nest Application → Lock Module: registers
README.md - Lock Module → Lock Options: accepts
lib/redisLock.module.ts - Lock Module → Options Token: provides
lib/redisLock.module.ts - Lock Module → Lock Service: exports
lib/redisLock.module.ts - Lock Service → Options Token: injects
lib/redisLock.service.ts - Lock Service → Lock Options: uses
lib/redisLock.service.ts - Nest Application → Lock Service: calls
README.md - Nest Application → Lock Decorator: decorates methods
README.md - Lock Decorator → Lock Service: locks and unlocks
lib/redisLock.decorator.ts - Lock Service → Redis Instance: sets, expires, deletes
lib/redisLock.service.ts