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

Method cacheNode

src/db/queries.ts:1276–1285  ·  view source on GitHub ↗

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

(node: Node)

Source from the content-addressed store, hash-verified

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

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