| 435 | } |
| 436 | |
| 437 | set(cacheKey: string, rawPatch: string, response: SemanticDiffResponse): void { |
| 438 | this.syncPatch(rawPatch); |
| 439 | |
| 440 | if (!this.cache.has(cacheKey) && this.cache.size >= this.maxEntries) { |
| 441 | const oldestKey = this.cache.keys().next().value; |
| 442 | if (typeof oldestKey === "string") { |
| 443 | this.cache.delete(oldestKey); |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | this.cache.set(cacheKey, response); |
| 448 | this.failures.delete(cacheKey); |
| 449 | } |
| 450 | |
| 451 | /** |
| 452 | * Memoize a FAILED run for a short window. Without this, every request for |