import type { DriverConstructor } from '../types'; declare const _default: (options: CacheOptions) => { name: string; init(db: Record, context: import("../types").ComputedContextGlobal): void; beforeGet(args: import("../typesClientEngine").GetArgsAny, ctx: import("../types").RadsRequestContext, context: import("../types").ComputedContext): Promise | Record[] | { nodes: Record[]; cursor: string | undefined; } | undefined>; afterGet(items: any[], args: import("../typesClientEngine").GetArgsAny, ctx: import("../types").RadsRequestContext, context: import("../types").ComputedContext): Promise; afterPut(items: import("../types").RadsHookDoc[], ctx: import("../types").RadsRequestContext, computedContext: import("../types").ComputedContext): Promise; }; export default _default; export interface EntityCacheOptions { driver?: DriverConstructor; /** * Number in seconds. If document was stored in cache more than maxAge seconds ago, cache is ignored. * 0 = 0s = all documents immediately expire, so never get anything from cache. * -1 = infinity = documents never expire (always returned from cache if exist) * defaults to 300 (5 minutes) * */ maxAge?: number; /** * Number in seconds. * If document was stored in cache more than staleWhileRevalidate seconds ago, cache is ignored. * If document was stored in cache less than staleWhileRevalidate seconds ago, * but more than maxAge seconds ago, it is immediately returned form cache, but also is downloaded again in the background. * 0 = 0s = documents are never revalidated in background * -1 = infinity = documents always are returned from cache immediately and revalidated in background * defaults to 0 * */ staleWhileRevalidate?: number; /** * Start preloading all data into cache immediately in the background. * After data are preloaded, getAll/getMany queries will start working from cache as well. * If your driver already contains data, "preload" will download only newly changed records (based on `updatedAt`) */ preload?: boolean; } export interface CacheOptions extends EntityCacheOptions { entities: Record; } export interface CacheStatus { preloadStatus?: 'upToDate' | 'updating' | 'loading' | 'error' | 'neverLoaded'; updatedAt?: string; } export interface CachePreloadOptions { entities: Record; noAwait?: boolean; revalidateInterval?: number; where?: any; } export interface CachePreloadEntityOptions { noAwait?: boolean; revalidateInterval?: number; where?: any; }