Skip to main content
Version: 1.x

MutexStorage

MutexStorage​

Interface for mutex storage implementations. Provides methods to store, retrieve, and delete mutex lock data.

Signature
interface MutexStorage {
acquire(
key: string,
timeout?: number,
signal?: AbortSignal,
): Promise<boolean>;
release(key: string): Promise<void>;
isLocked(key: string): Promise<boolean>;
}

acquire​

method
(key: string, timeout?: number, signal?: AbortSignal) => Promise<boolean>

Attempts to acquire a lock for a given key

release​

method
(key: string) => Promise<void>

Releases the lock for a given key

isLocked​

method
(key: string) => Promise<boolean>

Checks if a lock is currently held for a given key