/** * @file Cache System * @version 1.0.0 * @status STABLE - DO NOT MODIFY WITHOUT TESTS * @lastModified 2024-06-07 * * Simple in-memory caching system with TTL support * * IMPORTANT: * - Keep memory usage reasonable * - Provide clear invalidation mechanisms * * Functionality: * - Time-based expiration * - Chainable API * - Cache invalidation */ interface CacheOptions { ttl: number; } export declare class Cache { private cache; private defaultOptions; constructor(options?: Partial); /** * Get a value from the cache * @param key The cache key * @returns The cached value or undefined if not found or expired */ get(key: string): T | undefined; /** * Set a value in the cache * @param key The cache key * @param value The value to cache * @param options Optional cache options * @returns this instance for chaining */ set(key: string, value: T, options?: Partial): this; /** * Check if a key exists and is not expired * @param key The cache key * @returns True if the key exists and is not expired */ has(key: string): boolean; /** * Delete a key from the cache * @param key The cache key * @returns True if the key was deleted */ delete(key: string): boolean; /** * Clear all entries from the cache */ clear(): void; /** * Get a value from the cache, or compute and cache it if not found * @param key The cache key * @param factory Function to compute the value if not cached * @param options Optional cache options * @returns The cached or computed value */ getOrCompute(key: string, factory: () => Promise, options?: Partial): Promise; /** * Remove all expired entries from the cache * @returns Number of entries removed */ cleanup(): number; } export declare const blockCache: Cache; export declare const transactionCache: Cache; export declare const balanceCache: Cache; export declare const contractCache: Cache; export declare const ensCache: Cache; export declare function createCacheKey(prefix: string, ...parts: (string | number | undefined)[]): string; export {};