* Add a node to the cache, evicting oldest if needed
(node: Node)
| 853 | * Add a node to the cache, evicting oldest if needed |
| 854 | */ |
| 855 | private cacheNode(node: Node): void { |
| 856 | if (this.nodeCache.size >= this.maxCacheSize) { |
| 857 | // Evict oldest (first) entry |
| 858 | const firstKey = this.nodeCache.keys().next().value; |
| 859 | if (firstKey) { |
| 860 | this.nodeCache.delete(firstKey); |
| 861 | } |
| 862 | } |
| 863 | this.nodeCache.set(node.id, node); |
| 864 | } |
| 865 | |
| 866 | /** |
| 867 | * Clear the node cache |
no test coverage detected