/**
* @jorvel/ssr — request-keyed HTML cache for ETag-before-render.
*
* The default `LruHtmlCache` is an in-memory map with insertion-order eviction
* and an optional TTL. Replace with a Redis/KV-backed implementation in
* multi-instance deployments.
*/
export interface HtmlCacheEntry {
html: string;
etag: string;
status: number;
/** Unix milliseconds at which this entry was stored. */
storedAt: number;
}
export interface HtmlCache {
get(key: string): HtmlCacheEntry | undefined | Promise;
set(key: string, value: HtmlCacheEntry): void | Promise;
delete?(key: string): void | Promise;
}
export interface LruHtmlCacheOptions {
/** Maximum number of entries before eviction. Default 256. */
max?: number;
/** Entry TTL in ms. `undefined` keeps entries until evicted by capacity. */
ttlMs?: number;
}
export declare class LruHtmlCache implements HtmlCache {
private readonly map;
private readonly max;
private readonly ttlMs;
constructor(opts?: LruHtmlCacheOptions);
get(key: string): HtmlCacheEntry | undefined;
set(key: string, value: HtmlCacheEntry): void;
delete(key: string): void;
clear(): void;
get size(): number;
}
//# sourceMappingURL=html-cache.d.ts.map