| 13 | * Implementations can be local disk, remote server, memory, etc. |
| 14 | */ |
| 15 | export interface TranslationCache { |
| 16 | /** |
| 17 | * Get cached translations for a locale |
| 18 | * Returns empty object if no cache exists |
| 19 | */ |
| 20 | get(locale: LocaleCode): Promise<Record<string, string>>; |
| 21 | get(locale: LocaleCode, hashes: string[]): Promise<Record<string, string>>; |
| 22 | |
| 23 | /** |
| 24 | * Update cache with new translations |
| 25 | * Merges with existing cache (doesn't replace) |
| 26 | */ |
| 27 | update( |
| 28 | locale: LocaleCode, |
| 29 | translations: Record<string, string>, |
| 30 | ): Promise<void>; |
| 31 | |
| 32 | /** |
| 33 | * Replace entire cache for a locale |
| 34 | */ |
| 35 | set(locale: LocaleCode, translations: Record<string, string>): Promise<void>; |
| 36 | |
| 37 | /** |
| 38 | * Check if cache exists for a locale |
| 39 | */ |
| 40 | has(locale: LocaleCode): Promise<boolean>; |
| 41 | |
| 42 | /** |
| 43 | * Clear cache for a specific locale |
| 44 | */ |
| 45 | clear(locale: LocaleCode): Promise<void>; |
| 46 | |
| 47 | /** |
| 48 | * Clear all cached translations |
| 49 | */ |
| 50 | clearAll(): Promise<void>; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Configuration for local disk cache |
no outgoing calls
no test coverage detected