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

  • Updates the expiration date of a lock if it is currently held by the specified owner.

    Parameters

    • key: string

      The unique identifier for the lock.

    • lockId: string
    • expiration: Date

      The new date and time when the lock should expire.

    Returns Promise<number>

    Returns a number greater than or equal to 1 if the lock's expiration was updated, or 0 if the lock wasn't found or the owner didn't match.