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