jsonblade
Version:
A powerful and modular JSON template engine with extensible filters
31 lines • 988 B
TypeScript
interface CacheEntry {
compiledFunction: (data: any) => string;
lastUsed: number;
useCount: number;
}
declare class TemplateCache {
private cache;
private maxSize;
private ttl;
constructor(maxSize?: number, ttl?: number);
get(template: string): CacheEntry | undefined;
set(template: string, compiledFunction: (data: any) => string): void;
clear(): void;
getStats(): {
size: number;
maxSize: number;
hitRate: number;
};
private evictLRU;
}
export declare const templateCache: TemplateCache;
export declare function getCachedTemplate(template: string): ((data: any) => string) | undefined;
export declare function setCachedTemplate(template: string, compiledFunction: (data: any) => string): void;
export declare function clearTemplateCache(): void;
export declare function getTemplateStats(): {
size: number;
maxSize: number;
hitRate: number;
};
export {};
//# sourceMappingURL=template-cache.d.ts.map