set() — mcp Function Reference
Architecture documentation for the set() function in graph-cache.ts from the mcp codebase.
Entity Profile
Dependency Diagram
graph TD b965d3cf_dacd_81fc_77e7_dbe9bdef8bbc["set()"] 2f679171_fd3f_3cd5_48b2_587cc9ec01fd["buildIndexes()"] 2f679171_fd3f_3cd5_48b2_587cc9ec01fd -->|calls| b965d3cf_dacd_81fc_77e7_dbe9bdef8bbc f528cae6_71d3_4b84_026d_d4778648e9c8["loadCacheFromDisk()"] f528cae6_71d3_4b84_026d_d4778648e9c8 -->|calls| b965d3cf_dacd_81fc_77e7_dbe9bdef8bbc b9fca090_95d0_4cf7_0bb0_7a7efcc55ccb["resolveOrFetchGraph()"] b9fca090_95d0_4cf7_0bb0_7a7efcc55ccb -->|calls| b965d3cf_dacd_81fc_77e7_dbe9bdef8bbc 966fdd0a_509a_01b0_865e_32cfde84f964["precacheForDirectory()"] 966fdd0a_509a_01b0_865e_32cfde84f964 -->|calls| b965d3cf_dacd_81fc_77e7_dbe9bdef8bbc 4646463d_3032_7be4_79ae_2b8f22f309dd["setupHandlers()"] 4646463d_3032_7be4_79ae_2b8f22f309dd -->|calls| b965d3cf_dacd_81fc_77e7_dbe9bdef8bbc 73a484a3_5184_3a80_94a1_6b67c84b4f69["buildSubdomainToParentMap()"] 73a484a3_5184_3a80_94a1_6b67c84b4f69 -->|calls| b965d3cf_dacd_81fc_77e7_dbe9bdef8bbc fbeba3a0_8168_dd12_bca3_885bafcb50b5["getKeyFilesForDomain()"] fbeba3a0_8168_dd12_bca3_885bafcb50b5 -->|calls| b965d3cf_dacd_81fc_77e7_dbe9bdef8bbc f25d6639_05c4_e928_c1e5_13a8b4319dce["evictStale()"] b965d3cf_dacd_81fc_77e7_dbe9bdef8bbc -->|calls| f25d6639_05c4_e928_c1e5_13a8b4319dce 2b1b6788_6d42_4aa6_fb22_d64dd55ac2a3["evictOldest()"] b965d3cf_dacd_81fc_77e7_dbe9bdef8bbc -->|calls| 2b1b6788_6d42_4aa6_fb22_d64dd55ac2a3 style b965d3cf_dacd_81fc_77e7_dbe9bdef8bbc 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
Called By
Source
Frequently Asked Questions
What does set() do?
set() is a function in the mcp codebase.
What does set() call?
set() calls 2 function(s): evictOldest, evictStale.
What calls set()?
set() is called by 7 function(s): buildIndexes, buildSubdomainToParentMap, 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