set() — mcp Function Reference
Architecture documentation for the set() function in graph-cache.ts from the mcp codebase.
Entity Profile
Dependency Diagram
graph TD 4e1e5a38_002c_8f16_1767_0260a7001d5e["set()"] 04799611_7360_96bd_a002_0c06de0b1d90["GraphCache"] 4e1e5a38_002c_8f16_1767_0260a7001d5e -->|defined in| 04799611_7360_96bd_a002_0c06de0b1d90 f20c71b7_2411_d98b_88ba_3ebc36bdd1f5["buildIndexes()"] f20c71b7_2411_d98b_88ba_3ebc36bdd1f5 -->|calls| 4e1e5a38_002c_8f16_1767_0260a7001d5e 8e2a6102_97e1_76b1_c08e_d7b87f095026["loadCacheFromDisk()"] 8e2a6102_97e1_76b1_c08e_d7b87f095026 -->|calls| 4e1e5a38_002c_8f16_1767_0260a7001d5e 0c2dbb97_347e_7226_4d31_fbdcb85ac22b["resolveOrFetchGraph()"] 0c2dbb97_347e_7226_4d31_fbdcb85ac22b -->|calls| 4e1e5a38_002c_8f16_1767_0260a7001d5e 5f051fd3_b5fd_05fe_3e0b_f20364a0b064["precacheForDirectory()"] 5f051fd3_b5fd_05fe_3e0b_f20364a0b064 -->|calls| 4e1e5a38_002c_8f16_1767_0260a7001d5e 6471f5ca_fcb9_6e5d_af84_17b245dc7c0f["setupHandlers()"] 6471f5ca_fcb9_6e5d_af84_17b245dc7c0f -->|calls| 4e1e5a38_002c_8f16_1767_0260a7001d5e 88e2bfd3_c9cd_c8ac_4c2b_2911435fbb08["getKeyFilesForDomain()"] 88e2bfd3_c9cd_c8ac_4c2b_2911435fbb08 -->|calls| 4e1e5a38_002c_8f16_1767_0260a7001d5e 901790e8_bb47_a221_74f6_961092a7bb3f["evictStale()"] 4e1e5a38_002c_8f16_1767_0260a7001d5e -->|calls| 901790e8_bb47_a221_74f6_961092a7bb3f aa12a27e_97dc_0771_0ad0_d1af55e1e15d["evictOldest()"] 4e1e5a38_002c_8f16_1767_0260a7001d5e -->|calls| aa12a27e_97dc_0771_0ad0_d1af55e1e15d style 4e1e5a38_002c_8f16_1767_0260a7001d5e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/cache/graph-cache.ts lines 285–308
set(cacheKey: string, graph: IndexedGraph): void {
const nodeCount = graph.summary.nodeCount;
// Evict stale entries first
this.evictStale();
// Evict if needed
while (
(this.cache.size >= this.maxGraphs || this.currentNodes + nodeCount > this.maxNodes) &&
this.cache.size > 0
) {
this.evictOldest();
}
// Store
const now = Date.now();
this.cache.set(cacheKey, {
graph,
nodeCount,
lastAccessed: now,
createdAt: now,
});
this.currentNodes += nodeCount;
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does set() do?
set() is a function in the mcp codebase, defined in src/cache/graph-cache.ts.
Where is set() defined?
set() is defined in src/cache/graph-cache.ts at line 285.
What does set() call?
set() calls 2 function(s): evictOldest, evictStale.
What calls set()?
set() is called by 6 function(s): buildIndexes, getKeyFilesForDomain, loadCacheFromDisk, precacheForDirectory, resolveOrFetchGraph, setupHandlers.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free