Skip to main content
Version: Next

MemoryMutexStorage

MemoryMutexStorage

In-memory storage implementation for mutex locks. Suitable for single-instance applications.

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

acquire

method
(key: string, timeout: number = 30000, 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