semantic-ds-toolkit
Version:
Performance-first semantic layer for modern data stacks - Stable Column Anchors & intelligent inference
70 lines • 2.18 kB
TypeScript
import { StableColumnAnchor, ColumnFingerprint } from '../types/anchor.types';
interface CacheStats {
hits: number;
misses: number;
evictions: number;
hitRate: number;
memoryUsage: number;
entryCount: number;
}
interface CacheConfig {
l1MaxSize: number;
l2MaxSize: number;
l3MaxSize: number;
defaultTTL: number;
maxMemoryMB: number;
evictionPolicy: 'LRU' | 'LFU' | 'ADAPTIVE';
compressionThreshold: number;
}
type CacheKey = string;
type CacheValue = StableColumnAnchor | ColumnFingerprint | any;
export declare class MultiTierCacheManager {
private l1Cache;
private l2Cache;
private l3Cache;
private config;
private globalStats;
private compressionCache;
constructor(config?: Partial<CacheConfig>);
get(key: CacheKey): CacheValue | undefined;
set(key: CacheKey, value: CacheValue, options?: {
ttl?: number;
tier?: 1 | 2 | 3;
}): void;
private shouldPromoteToL1;
private shouldPromoteToL2;
private isAnchor;
private isFingerprint;
private maybeCompress;
private maybeDecompress;
private generateCompressionKey;
private calculateSize;
private enforceMemoryLimits;
private getCurrentMemoryUsage;
private updateGlobalStats;
invalidateAnchor(anchorId: string): void;
invalidateDataset(datasetName: string): void;
private invalidatePattern;
mget(keys: CacheKey[]): Map<CacheKey, CacheValue>;
mset(entries: Array<{
key: CacheKey;
value: CacheValue;
options?: any;
}>): void;
preload(keys: CacheKey[], loader: (key: CacheKey) => Promise<CacheValue>): Promise<void>;
warmup(anchorIds: string[]): void;
getStats(): {
global: CacheStats;
l1: CacheStats;
l2: CacheStats;
l3: CacheStats;
compressionRatio: number;
};
clear(): void;
static anchorKey(anchorId: string): string;
static fingerprintKey(columnHash: string): string;
static reconciliationKey(datasetName: string, columnName: string): string;
}
export declare const globalCacheManager: MultiTierCacheManager;
export {};
//# sourceMappingURL=cache-manager.d.ts.map