API reference › @evolu/common › Task › MutexByKey
Defined in: packages/common/src/Task.ts:6057
Runs Tasks one at a time independently for each key, like Mutex.
Properties
isIdle
readonly isIdle: (key: K) => boolean;
Defined in: packages/common/src/Task.ts:6062
Whether the lock for the key is neither held nor queued.
snapshot
readonly snapshot: (key: K) =>
| SemaphoreSnapshot
| null;
Defined in: packages/common/src/Task.ts:6065
Returns the current key lock state, or null when the key is idle.
withLock
readonly withLock: <T, E, D>(key: K, task: Task<T, E, D>) => Task<T, E, D>;
Defined in: packages/common/src/Task.ts:6059
Runs a Task while holding the lock for the key.