/** * Cache callback result which has to be returned by the `CacheCallback` function. */ export interface CacheResult { /** * The data which should be added to the cache */ data: TResult; /** * `data` can only be cached if this is not `true` */ isPrivate?: boolean; } /** * Simple helper type for defining the `CacheCallback` function return type */ export declare type CachePromise = Promise>; /** * The callback function which is called on cache miss. */ export declare type CacheCallback = (lookup: TArg) => CachePromise; export declare type CacheConfig = { /** * Datasource id */ id: string; /** * Cache key */ lookup: TArg; /** * Callback to use on cache miss to load result */ cb: CacheCallback; /** * Time to cache result in minutes */ minutes?: number; }; /** * Loads result from cache or from passed callback on cache miss. * @param param0 Cache config args */ export declare function cacheAble({ id, lookup, cb, minutes, }: CacheConfig): Promise;