To utilize the KyselyLockAdapter, you must install the "kysely" package and configure a Kysely class instance.

Note in order to use KyselyLockAdapter correctly, ensure you use a single, consistent database across all server instances. The adapter have been tested with sqlite, postgres and mysql databases.

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

Implements

Constructors

Methods

  • The insert method will create a lock if it does not exist and if the lock already exists an error must be thrown.

    Parameters

    • key: string
    • owner: string
    • expiration: null | Date

    Returns Promise<void>

  • The refresh method will upadte expiration of lock if it matches the given key and matches the given owner.

    Parameters

    • key: string
    • owner: string
    • expiration: Date

    Returns Promise<number>

    Returns number of updated rows or documents.

  • The update method will update a lock if it has expired, matches the given key and matches the given owner.

    Parameters

    • key: string
    • owner: string
    • expiration: null | Date

    Returns Promise<number>

    Returns number of updated rows or documents.