{"library":"redfour","type":"library","category":null,"description":"A Redis-based binary semaphore implementation using pub/sub for fast async wait, unlike polling-based alternatives. Version 2.2.2 is the latest stable release. Key differentiator: uses Redis pub/sub to notify waiters when a lock is released, making it much faster than polling-based locks. Supports Node >=7.6.0. Ideal for coordinating access to shared resources (e.g., token refresh) across multiple processes or servers.","language":"javascript","status":"active","version":"2.2.2","tags":["javascript","redis","semaphore","mutex","node"],"last_verified":"Sun Jun 07","install":[{"cmd":"npm install redfour","imports":["import Lock from 'redfour'","const Lock = require('redfour')","const lock = new Lock({ redis: '...', namespace: 'test' });\nawait lock.acquireLock(id, ttl);\nawait lock.waitAcquireLock(id, ttl, timeout);\nawait lock.releaseLock(lockObj);"]},{"cmd":"yarn add redfour","imports":[]},{"cmd":"pnpm add redfour","imports":[]}],"homepage":"https://github.com/mixmaxhq/redfour#readme","github":"https://github.com/mixmaxhq/redfour","docs":null,"changelog":null,"pypi":null,"npm":"redfour","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":null}