* Clear specific caches by name. * @param names Array of cache names to clear
(names: string[])
| 147 | * @param names Array of cache names to clear |
| 148 | */ |
| 149 | clearByNames(names: string[]): void { |
| 150 | if (this.isClearing) { |
| 151 | appLogger.warn('[CacheManager] clearAll already in progress, skipping clearByNames'); |
| 152 | return; |
| 153 | } |
| 154 | |
| 155 | this.isClearing = true; |
| 156 | |
| 157 | try { |
| 158 | // Get matching entries sorted by priority |
| 159 | const entries = names |
| 160 | .map((name) => this.entries.get(name)) |
| 161 | .filter((entry): entry is CacheEntry => entry !== undefined) |
| 162 | .sort((a, b) => a.priority - b.priority); |
| 163 | |
| 164 | for (const entry of entries) { |
| 165 | try { |
| 166 | entry.clear(); |
| 167 | } catch (err) { |
| 168 | appLogger.error(`[CacheManager] Error clearing "${entry.name}":`, err); |
| 169 | } |
| 170 | } |
| 171 | } finally { |
| 172 | this.isClearing = false; |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * Get list of registered cache names (for debugging). |