import type { SimEvent } from '../../types/events.ts'; import { ComponentType } from '../../types/components.ts'; import type { SimComponent, SimContext, ComponentConfig, ComponentMetrics } from '../../types/components.ts'; import type { CacheConfig } from '../../types/configs.ts'; /** * Cache component with key-based caching, TTL, bounded size, and eviction. * * When a work unit arrives: * - If the work unit has a non-empty key and that key is in the cache (and not expired), it's a hit. * - Otherwise it's a miss: forward to downstream with originClientId rewritten to this cache's ID * so the response routes back through the cache. On departure, restore the real origin, cache * the key (on success), and forward to the client. * - If no key is set on the work unit, fall back to probabilistic hitRate. */ export declare class Cache implements SimComponent { readonly id: string; readonly type = ComponentType.CACHE; readonly config: ComponentConfig; private cacheConfig; private store; private lruHead; private lruTail; private pendingOrigins; private hitCount; private missCount; private totalRequests; constructor(id: string, cacheConfig: CacheConfig); handleEvent(event: SimEvent, context: SimContext): SimEvent[]; private handleArrival; private handleDeparture; private isExpired; private insertKey; /** O(1) eviction: remove the head of the list (oldest for FIFO, least-recently-used for LRU) */ private evict; private removeKey; /** Remove an entry from the doubly-linked list */ private unlinkEntry; /** Append an entry at the tail of the list (most recently used) */ private appendEntry; private createDepartureToOrigin; private recordMetrics; getMetrics(): ComponentMetrics; reset(): void; /** Clear all cached entries (used by failure injector for cache-flush). */ flush(): void; } //# sourceMappingURL=cache.d.ts.map