redis-mutex-semaphore

JSON →
library 0.3.7 ·javascript
verified Jun 7, 2026

Mutex and semaphore library implemented using basic Redis commands. Current stable version 0.3.7. Provides two synchronization primitives: mutex (exclusive lock with TTL) and semaphore (counting semaphore). Key differentiator: simple API using callbacks or promises, supports existing Redis connections, and includes wait/observe mechanisms with priority ordering. Unlike redlock or ioredis-based lock libraries, this uses basic Redis commands (SETNX, WATCH, etc.) without Lua scripting. The create methods reset the Redis key, which can lead to accidental context loss — a common footgun. Minimum Redis version 2.6.0+.