Type Alias IDatabaseCacheAdapter<TType>

IDatabaseCacheAdapter: {
    find(key: string): Promise<null | ICacheData<TType>>;
    removeAll(): Promise<void>;
    removeByKeyPrefix(prefix: string): Promise<void>;
    removeMany(keys: string[]): Promise<ICacheDataExpiration[]>;
    transaction<TValue>(
        trxFn: InvokableFn<
            [trx: IDatabaseCacheTransaction<TType>],
            Promise<TValue>,
        >,
    ): Promise<TValue>;
    update(key: string, value: TType): Promise<null | ICacheDataExpiration>;
}

The IDatabaseCacheAdapter contract defines a way for as key-value pairs independent of data storage. This contract simplifies the implementation of cache adapters with CRUD-based databases, such as SQL databases and ORMs like TypeOrm and MikroOrm.

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

Type Parameters

  • TType = unknown

Type declaration