import type { RenderResult } from "../orchestrator/types.js"; import type { CacheStore } from "./types.js"; import { type MemoryCacheStoreOptions } from "./stores/index.js"; export interface CacheCoordinatorOptions { store?: CacheStore; memory?: MemoryCacheStoreOptions; /** Logical freshness window in milliseconds. Zero means no logical expiration. */ ttlMs?: number; /** Stale-while-refresh window in milliseconds; ignored when `ttlMs` is zero. */ staleMs?: number; /** * Project identifier for cache key prefixing. * Required for multi-tenant isolation - all cache keys will be prefixed with this value. * * This should be a unique identifier per project: * - In production: The project UUID from the database * - In local dev: A hash generated from the projectDir (e.g., "proj_abc123") * * Note: This is NOT the human-readable projectSlug (like "minimal-app-router"). * Use the unique ID to ensure cache isolation even if slugs are reused. */ projectId?: string; /** * Content source identifier for cache isolation (e.g., "main", "release-123"). * Ensures different branches/releases have separate cache entries. */ contentSourceId?: string; } export type CacheLookupStatus = "hit" | "miss" | "stale" | "expired"; export interface CacheLookupResult { cachedResult?: RenderResult; depAwareSlug: string; moduleCacheKey: string; cachedModule?: RenderResult["pageModule"]; cacheStatus: CacheLookupStatus; lookupDurationMs: number; } export declare class CacheCoordinator { private store; private readonly ttlMs; private readonly staleMs; private readonly defaultTtlMs; private readonly projectId; private readonly contentSourceId; private readonly cachePrefix; private readonly pendingEvictions; constructor(options?: CacheCoordinatorOptions); /** * Build a fully-qualified cache key with project prefix. * @param slug - The base slug or cache key * @param cacheKey - Optional explicit cache key (still gets prefixed) */ private buildCacheKey; checkCache(slug: string, cacheKey?: string, nonce?: string): Promise; persistResult(result: RenderResult, slug: string, cacheKey?: string, nonce?: string): Promise; clearAll(): Promise; clearSlug(slug: string): Promise; /** * Clear all cache entries for the current project. * Only clears entries with the current project prefix. */ clearForProject(): Promise; destroy(): Promise; private isExpired; private scheduleEviction; private isStaleUsable; private hydrateResult; } //# sourceMappingURL=cache-coordinator.d.ts.map