* Remove oldest entries if cache is full (LRU)
()
| 104 | * Remove oldest entries if cache is full (LRU) |
| 105 | */ |
| 106 | enforceSizeLimit() { |
| 107 | if (this.cache.size > this.maxSize) { |
| 108 | // Get first (oldest) entry |
| 109 | const firstKey = this.cache.keys().next().value; |
| 110 | this.cache.delete(firstKey); |
| 111 | log('[FileCache] Pruned oldest entry:', firstKey); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Clear entire cache |