import type { EntityConfiguration } from '../EntityConfiguration.ts'; import type { IEntityCacheAdapter } from '../IEntityCacheAdapter.ts'; import type { IEntityLoadKey, IEntityLoadValue } from './EntityLoadInterfaces.ts'; /** * @internal */ export declare enum CacheStatus { HIT = 0, MISS = 1, NEGATIVE = 2 } /** * @internal */ export type CacheLoadResult> = { status: CacheStatus.HIT; item: Readonly; } | { status: CacheStatus.MISS; } | { status: CacheStatus.NEGATIVE; }; /** * A read-through entity cache is responsible for coordinating EntityDatabaseAdapter and * EntityCacheAdapter within the EntityDataManager. * * @internal */ export declare class ReadThroughEntityCache, TIDField extends keyof TFields> { private readonly entityConfiguration; private readonly entityCacheAdapter; constructor(entityConfiguration: EntityConfiguration, entityCacheAdapter: IEntityCacheAdapter); private isLoadKeyCacheable; /** * Read-through cache function. Steps: * * 1. Check for cached (key, value) objects * 2. Query the fetcher for values not in the cache * 3. Cache the results from the fetcher * 4. Negatively cache anything missing from the fetcher * 5. Return the full set of data for the query. * * If cache is not applicable for key, return results from fetcher. * * @param key - load key being queried * @param values - load values being queried * @param fetcher - closure used to provide underlying data source objects for key and fetcherValues * @returns map from value to objects that match the query for that value */ readManyThroughAsync, TSerializedLoadValue, TLoadValue extends IEntityLoadValue>(key: TLoadKey, values: readonly TLoadValue[], fetcher: (fetcherValues: readonly TLoadValue[]) => Promise[]>>): Promise[]>>; /** * Invalidate the cache for objects cached by (key, value). * * @param key - load key to be invalidated * @param values - load values to be invalidated for key */ invalidateManyAsync, TSerializedLoadValue, TLoadValue extends IEntityLoadValue>(key: TLoadKey, values: readonly TLoadValue[]): Promise; }