/** * Memory Cache for SSR Modules - Redis-First Architecture * * Optimized for ephemeral pods with limited memory. * * Strategy: * - Redis: Primary storage for transformed code (shared across pods) * - Memory: Small LRU cache for temp file path tracking only * * The actual transformed code lives in Redis and temp files. * Memory only stores { tempPath, contentHash } pointers. * * @module module-system/react-loader/ssr-module-loader/cache/memory */ import { LRUCache } from "../../../../utils/lru-wrapper.js"; import { Semaphore } from "../concurrency/semaphore.js"; import type { FailureRecord, ModuleCacheEntry } from "../types.js"; export declare const globalModuleCache: LRUCache; export declare const globalCrossProjectCache: LRUCache; export declare const globalInProgress: Map>; export declare const globalTmpDirs: LRUCache; export declare const failedComponents: Map; export interface ClearSSRModuleCacheForProjectOptions { /** * Preserve live transform ownership and per-project capacity waiters while * clearing request-visible cache entries. Dev SSR request starts use this so * concurrent cold requests do not delete another request's transform leader * before it can publish its completed cache entry. */ preserveActiveTransforms?: boolean; } export declare function getTransformSemaphore(): Semaphore; /** * Attempt to acquire a project-level transform slot immediately. * Returns true if acquired, false if project is at capacity. * * Note: The "__single__" project and projects with "local-" prefix bypass * rate limiting since there's no noisy-neighbor concern in single-project mode. * `bypass` forces the same behavior for callers that know they are * single-tenant (e.g. the dev server, whose projectId is the project slug and * therefore does not match the prefix allowlist). When bypassing, no slot is * tracked, so the matching {@link releaseTransformSlot} must also bypass. */ export declare function acquireTransformSlot(projectId: string, bypass?: boolean): boolean; /** * Try to acquire a project-level transform slot with retries. * Waits up to timeoutMs for a slot to become available. * Returns true if acquired, false if timed out, and rejects with the abort * reason when the caller's signal aborts while queued. */ export declare function tryAcquireTransformSlot(projectId: string, timeoutMs: number, bypass?: boolean, signal?: AbortSignal): Promise; /** * Release a project-level transform slot. `bypass` must match the value * passed to the corresponding {@link acquireTransformSlot} so a bypassing * caller never decrements another caller's tracked count. */ export declare function releaseTransformSlot(projectId: string, bypass?: boolean): void; /** * Get per-project transform statistics. */ export declare function getTransformStats(): { globalAvailable: number; globalWaiting: number; perProjectLimit: number; activeProjects: Map; }; export declare function clearSSRModuleCache(): void; export declare function clearSSRModuleCacheForProject(projectId: string, options?: ClearSSRModuleCacheForProjectOptions): void; //# sourceMappingURL=memory.d.ts.map