cdk-insights
Version:
AWS CDK security and cost analysis tool with AI-powered insights
35 lines (34 loc) • 1.74 kB
TypeScript
import type { CloudFormationResource } from '../../types/analysis.types';
import type { CacheKeyComponents, FileBasedCacheEntry, FileModificationInfo } from './memoization.types';
export declare const getFileModificationInfo: (filePath: string) => FileModificationInfo | null;
export declare const getFilesModificationInfo: (filePaths: string[]) => Record<string, FileModificationInfo>;
export declare const generateAuthContext: (authToken?: string, fingerprint?: string) => string;
export declare const generateResourceHash: (resource: CloudFormationResource) => string;
export declare const createCacheKeyComponents: (resourceId: string, resource: CloudFormationResource, authToken?: string, fingerprint?: string, sourceFiles?: string[]) => CacheKeyComponents;
export declare const generateCacheKey: (components: CacheKeyComponents) => string;
export declare const isCacheEntryValid: <T>(entry: FileBasedCacheEntry<T>, currentComponents: CacheKeyComponents) => boolean;
export declare class FileBasedCache<T> {
private cache;
private readonly ttl;
private readonly maxSize;
constructor(options?: {
ttl?: number;
maxSize?: number;
});
get(key: string): T | undefined;
set(key: string, value: T, components: CacheKeyComponents, customTtl?: number): void;
has(key: string): boolean;
clear(): void;
size(): number;
private evictOldest;
getStats(): {
size: number;
maxSize: number;
hitRate: number;
totalHits: number;
totalMisses: number;
};
getAllCachedResults(): Map<string, FileBasedCacheEntry<T>>;
getCachedResultsForResources(resourceIds: string[]): Map<string, T>;
hasCachedResult(resourceId: string): boolean;
}