Type Alias WithLockSettings<TParameters>

WithLockSettings: {
    key: Invokable<TParameters, string>;
    lockId?: Invokable<TParameters, string>;
    ttl?: ITimeSpan | null;
}

Settings for the distributed-lock middleware.

Type Parameters

  • TParameters extends unknown[] = unknown[]

    Tuple type of the wrapped function's parameters.

Type declaration

  • key: Invokable<TParameters, string>

    A function or static value that produces the lock key from the wrapped function's arguments. The lock is acquired on this key, ensuring mutual exclusion across processes for the same key.

  • OptionallockId?: Invokable<TParameters, string>

    A function or static value that produces a unique identifier for the current lock acquisition attempt. The lock ID distinguishes competing consumers trying to acquire the same lock.

    import { v4 } from "uuid";

    () => v4()
  • Optionalttl?: ITimeSpan | null

    Time-to-live for the lock. If null the lock never expires automatically. If omitted the default TTL of the lock factory is used.