@apiratorjs/locking-redis
Version:
An extension to the core @apiratorjs/locking library, providing Redis-based implementations of distributed mutexes and semaphores for true cross-process concurrency control in Node.js.
18 lines • 776 B
TypeScript
import { types } from "@apiratorjs/locking";
export declare class DistributedReleaser<T extends types.TAcquireToken = types.TAcquireToken> implements types.IReleaser<T> {
private readonly onRelease;
private readonly token;
private isReleased;
private releasePromise;
constructor(onRelease: () => Promise<void>, token: T);
/**
* Releasing is idempotent: one releaser owns exactly one acquisition, so
* repeated calls must not unlock again (or hand a semaphore permit back twice).
*
* A failed `onRelease` does not stick the releaser in a released state, so
* the caller can retry after a transient Redis/network error.
*/
release(): Promise<void>;
getToken(): T;
}
//# sourceMappingURL=distributed-releaser.d.ts.map