/** * File Cache - Backend-Abstracted Architecture * * Caches file content with secure multi-tenant support. * * Strategy: * - Uses CacheBackend abstraction for backend selection * - API Mode (production): Uses veryfront-api for centralized cache * - Redis Mode (local dev/open source): Direct Redis access * - Memory Mode (fallback): In-memory cache * * Security: In production, renderer has no Redis credentials. * All cache access goes through the API which enforces tenant isolation. */ import type { CacheStats, FileCacheOptions } from "./types.js"; /** * Initialize file cache backend. * Call this at startup if you want to enable distributed caching. */ export declare function initializeFileCacheBackend(): Promise; /** * Check if distributed caching is enabled for file cache. */ export declare function isFileCacheDistributedEnabled(): boolean; /** * FileCache - Backend-First with Local Fallback * * When backend is available: Uses backend (API/Redis) * When backend unavailable: Small memory fallback for local dev */ export declare class FileCache { private fallbackCache; private fallbackMemoryUsed; private options; private immutableL1TtlOverride; private backendTtlSeconds; private hits; private misses; constructor(options?: FileCacheOptions); private getImmutableL1Ttl; private getBackend; /** * Synchronous get - only checks fallback cache (for local dev without backend). * In production with backend, use getAsync instead. */ get(key: string): T | undefined; /** * Async get - checks backend (primary) or fallback memory cache. * Uses request-scoped batching for API backend to reduce N+1 queries. */ getAsync(key: string): Promise; /** * Synchronous set - only writes to fallback cache (for local dev without backend). * In production with backend, use setAsync instead. */ set(key: string, value: T): void; /** * Async set - writes to backend (primary) or fallback memory cache. */ setAsync(key: string, value: T): Promise; /** Write to fallback memory cache with size check and eviction. */ private setToFallback; has(key: string): boolean; delete(key: string): boolean; deleteAsync(key: string): Promise; /** Clears only the in-memory fallback cache entries by prefix. Does NOT touch the backend. */ private clearLocalByPrefix; /** Clears only the in-memory fallback cache entries by prefix+suffix. Does NOT touch the backend. */ private clearLocalByPrefixAndSuffix; deleteByPrefix(prefix: string): number; deleteByPrefixAsync(prefix: string): Promise; deleteByPrefixAndSuffix(prefix: string, suffix: string): number; deleteByPrefixAndSuffixAsync(prefix: string, suffix: string): Promise; clear(): void; /** * Counters for this instance, across every tier it reads through. * * `hits` does not separate tiers: a process-local immutable release hit, a * request-scoped hit and a backend hit all increment it, and `size` and * `memoryUsed` describe only the local fallback map. So a high hit rate here * does not by itself say how many backend round trips were avoided. */ stats(): CacheStats & { backend: string; }; evictExpired(): number; private evictFallbackIfNeeded; } //# sourceMappingURL=file-cache.d.ts.map