/** * Simplified memory cache handler */ import { EventEmitter } from '../base/event-emitter.js'; import { ISyncHandler } from '../interfaces/handler.interface.js'; import { IStatsProvider, ISyncRepository } from '../interfaces/repository.interface.js'; import type { TranslationData } from '../types/translation-data.types.js'; import type { TranslationContext, TranslationRequest, TranslationResult } from '../types/translation.types.js'; /** * Simple memory cache handler */ export declare class SyncHandler implements ISyncHandler { readonly name: string; readonly version = "1.0.0"; readonly priority: number; readonly type: "memory"; readonly enabled: boolean; private ttlMap; private ttl; private repository; private bus; constructor(eventEmitter: EventEmitter, repository: ISyncRepository & IStatsProvider); getSourceType(): 'memory' | 'storage' | 'network' | 'fallback'; /** * Simple lookup implementation * Returns ContentUnit with both text and styles */ lookup(request: TranslationRequest): TranslationResult; /** * Simple save implementation * Stores ContentUnit (text + styles) as JSON */ save(request: TranslationRequest, result: TranslationResult): void; /** * Namespace saving implementation */ saveNamespace(translations: TranslationData, context: TranslationContext): void; /** * ✅ Strategy 1: Direct cache lookup using unified pattern * Returns parsed ContentUnit (text + styles) or null */ private tryDirectLookup; /** * ✅ Strategy 2: Namespace lookup using unified pattern * Returns parsed ContentUnit (text + styles) or null */ private tryNamespaceLookup; /** * Helper to create consistent TranslationResult objects * Now includes styles from ContentUnit */ private createResult; /** * Check TTL and expire if needed * Returns true if expired, false if still valid */ private checkAndExpireTTL; /** * Set value in repository and update TTL */ private setWithTTL; /** * Refresh TTL on access */ private refreshTTL; /** * Get TTL information for debugging */ getTTLInfo(): Record; getEntries(): Record | undefined; /** * Clear all entries for a specific namespace * Removes namespace cache entry, individual keys, and TTL entries */ clearNamespace(locale: string, namespace: string): void; destroy(): void; /** * Direct cache set (for optimistic updates) * Bypasses event emission for direct cache manipulation * Stores as ContentUnit JSON (text + styles) */ setCache(key: string, value: string, styles?: Record): void; } //# sourceMappingURL=sync-storage-handler.d.ts.map