* Add a node to the cache, evicting oldest if needed
(node: Node)
| 1274 | * Add a node to the cache, evicting oldest if needed |
| 1275 | */ |
| 1276 | private cacheNode(node: Node): void { |
| 1277 | if (this.nodeCache.size >= this.maxCacheSize) { |
| 1278 | // Evict oldest (first) entry |
| 1279 | const firstKey = this.nodeCache.keys().next().value; |
| 1280 | if (firstKey) { |
| 1281 | this.nodeCache.delete(firstKey); |
| 1282 | } |
| 1283 | } |
| 1284 | this.nodeCache.set(node.id, node); |
| 1285 | } |
| 1286 | |
| 1287 | /** |
| 1288 | * Clear the node cache |
no test coverage detected