Type Alias ILockAdapter

ILockAdapter: {
    acquire(key: string, owner: string, ttl: null | TimeSpan): PromiseLike<boolean>;
    forceRelease(key: string): PromiseLike<void>;
    getGroup(): string;
    refresh(key: string, owner: string, ttl: TimeSpan): PromiseLike<boolean>;
    release(key: string, owner: string): PromiseLike<boolean>;
    withGroup(group: string): ILockAdapter;
}

The ILockAdapter contract defines a way for managing locks independent of the underlying technology. This contract is not meant to be used directly, instead you should use ILockProvider contract.

IMPORT_PATH: "@daiso-tech/core/lock/contracts"

Type declaration

  • acquire:function
    • The acquire method acquires a lock only if the lock is not already acquired. Returns true if not already acquired othewise false is returned.

      Parameters

      • key: string
      • owner: string
      • ttl: null | TimeSpan

      Returns PromiseLike<boolean>

  • forceRelease:function
  • getGroup:function
  • refresh:function
    • The refresh method will upadte ttl of lock if it matches the given key and matches the given owner. Returns true if the update occured otherwise false is returned.

      Parameters

      Returns PromiseLike<boolean>

  • release:function
    • The release method releases a lock if the owner matches. Returns true if released otherwise false is returned.

      Parameters

      • key: string
      • owner: string

      Returns PromiseLike<boolean>

  • withGroup:function