* Add a node to the cache, evicting oldest if needed
(node: Node)
| 510 | * Add a node to the cache, evicting oldest if needed |
| 511 | */ |
| 512 | private cacheNode(node: Node): void { |
| 513 | if (this.nodeCache.size >= this.maxCacheSize) { |
| 514 | // Evict oldest (first) entry |
| 515 | const firstKey = this.nodeCache.keys().next().value; |
| 516 | if (firstKey) { |
| 517 | this.nodeCache.delete(firstKey); |
| 518 | } |
| 519 | } |
| 520 | this.nodeCache.set(node.id, node); |
| 521 | } |
| 522 | |
| 523 | /** |
| 524 | * Clear the node cache |
no test coverage detected