import { Logger } from '@chimera-monorepo/utils'; /** * Cache item used in ProviderCache schema property; either blocks to live (BTL) or time to live (TTL) must * be specified (the former is preferred but the latter can be used as a backup when a block listener will not * be actively updating the cache's block number). */ type ProviderCacheSchema = { [K in keyof T]: { btl: number; ttl?: number; } | { btl?: number; ttl: number; }; }; /** * @classdesc A data structure for managing time-sensitive (expiring) cached information from chain * that expires after a set number of blocks or amount of time. */ export declare class ProviderCache { private readonly logger; private readonly schema; private _blockNumber; get blockNumber(): number; private _data; get data(): Partial; /** * @param schema - A schema for the cache that determines whether each item expires after a set period of * time (ttl, ms) or a set number of blocks (btl, number). */ constructor(logger: Logger, schema: ProviderCacheSchema); /** * Update the cache block number, and optionally the data. * @param blockNumber - Current block number. * @param data - Optional data to update the cache with. */ update(blockNumber: number, data?: Partial): void; /** * Set a value in the cache. * @param data - The data to set. */ set(data: Partial): void; /** * Helper for retrieving item from data depending on whether it's expired. * @param key - a key of the cache data schema. * @returns */ private getItem; } export {}; //# sourceMappingURL=cache.d.ts.map