MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / cacheNode

Method cacheNode

src/db/queries.ts:1278–1287  ·  view source on GitHub ↗

* Add a node to the cache, evicting oldest if needed

(node: Node)

Source from the content-addressed store, hash-verified

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

Callers 2

getNodeByIdMethod · 0.95
getNodesByIdsMethod · 0.95

Calls 3

nextMethod · 0.80
deleteMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected