Type Alias IDatabaseCacheTransaction<TType>

IDatabaseCacheTransaction: {
    find(
        context: IReadableContext,
        key: string,
    ): Promise<null | ICacheData<TType>>;
    upsert(
        context: IReadableContext,
        key: string,
        value: TType,
        expiration?: null | Date,
    ): Promise<void>;
}

Transaction context for atomic cache operations. Provides methods to read and modify cache state within a database transaction.

All transaction methods run atomically:

  • Multiple operations execute as a single unit
  • Either all succeed or all fail together
  • No partial updates visible to other transactions

Type Parameters

  • TType = unknown

    The type of data managed by this cache (defaults to unknown)

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

Type declaration

  • find:function
  • upsert:function
    • Creates or updates a cache entry with optional expiration. Sets (upserts) the value at the key, overwriting any existing entry.

      Parameters

      • context: IReadableContext

        Readable execution context for the operation

      • key: string

        The cache key identifier

      • value: TType

        The value to cache

      • Optionalexpiration: null | Date

        When the cache entry should expire (optional, null = never expires)

      Returns Promise<void>

      Void (always succeeds)