/** * @nahisaho/yata-scale - Cache Manager * * Multi-tier caching for knowledge graph */ import { type Result } from 'neverthrow'; import type { Entity, Relationship, CacheConfig, CacheStats } from './types.js'; import { EntityNotFoundError } from './errors.js'; /** * L1 Cache - Hot tier (in-memory LRU) */ export declare class L1Cache { private cache; private hits; private misses; private evictions; constructor(maxEntries: number, ttlMs: number); set(item: Entity | Relationship): void; get(id: string): Entity | Relationship | undefined; delete(id: string): void; clear(): void; get size(): number; getStats(): CacheStats; } /** * L2 Cache - Warm tier (compressed in-memory) */ export declare class L2Cache { private cache; private maxSize; private currentSize; private hits; private misses; private evictions; private accessOrder; constructor(maxSize: number, _ttlMs: number); set(item: Entity | Relationship): Promise; get(id: string): Promise; delete(id: string): Promise; clear(): Promise; get approximateSize(): number; getStats(): CacheStats; } /** * L3 Cache - Cold tier (disk-based simulation) */ export declare class L3Cache { private storage; private maxEntries; private hits; private misses; private evictions; constructor(config: { maxEntries: number; }); set(item: Entity | Relationship): Promise; get(id: string): Promise; delete(id: string): Promise; has(id: string): Promise; clear(): Promise; close(): Promise; getStats(): CacheStats; } /** * Cache invalidation manager */ export declare class InvalidationManager { private pending; private tracked; private listeners; private batchSize; constructor(batchSize?: number); invalidate(id: string): void; invalidateByPattern(pattern: string): void; trackEntity(id: string): void; flush(): void; onInvalidation(callback: (ids: string[]) => void): void; removeListener(callback: (ids: string[]) => void): void; get pendingCount(): number; clear(): void; } /** * Multi-tier cache manager */ export declare class CacheManager { private l1; private l2; private l3; private invalidation; constructor(config: CacheConfig); setEntity(entity: Entity): Promise; getEntity(id: string): Promise>; deleteEntity(id: string): Promise; setRelationship(rel: Relationship): Promise; getRelationship(id: string): Promise>; deleteRelationship(id: string): Promise; invalidate(ids: string[]): Promise; warm(entities: Entity[]): Promise; clear(): Promise; close(): Promise; getAllStats(): { l1: CacheStats; l2: CacheStats; l3: CacheStats; }; } //# sourceMappingURL=CacheManager.d.ts.map