Home / Function/ saveCacheToDisk() — mcp Function Reference

saveCacheToDisk() — mcp Function Reference

Architecture documentation for the saveCacheToDisk() function in graph-cache.ts from the mcp codebase.

Entity Profile

Dependency Diagram

graph TD
  e3133d6c_87dc_b74a_abf7_6097334e0493["saveCacheToDisk()"]
  9003922a_3c12_9d09_182b_1d8c2e1893be["precacheForDirectory()"]
  9003922a_3c12_9d09_182b_1d8c2e1893be -->|calls| e3133d6c_87dc_b74a_abf7_6097334e0493
  82fac0c2_5c5b_e41e_ab86_c3cdc89a84c7["sanitizeFileName()"]
  e3133d6c_87dc_b74a_abf7_6097334e0493 -->|calls| 82fac0c2_5c5b_e41e_ab86_c3cdc89a84c7
  style e3133d6c_87dc_b74a_abf7_6097334e0493 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/cache/graph-cache.ts lines 371–392

export async function saveCacheToDisk(
  cacheDir: string,
  repoName: string,
  raw: SupermodelIR,
  commitHash?: string
): Promise<string> {
  await fs.mkdir(cacheDir, { recursive: true });

  const fileName = `${sanitizeFileName(repoName)}.json`;
  const filePath = join(cacheDir, fileName);

  const payload = {
    version: 1,
    repoName,
    commitHash: commitHash || null,
    savedAt: new Date().toISOString(),
    raw,
  };

  await fs.writeFile(filePath, JSON.stringify(payload));
  return filePath;
}

Domain

Subdomains

Frequently Asked Questions

What does saveCacheToDisk() do?
saveCacheToDisk() is a function in the mcp codebase.
What does saveCacheToDisk() call?
saveCacheToDisk() calls 1 function(s): sanitizeFileName.
What calls saveCacheToDisk()?
saveCacheToDisk() is called by 1 function(s): precacheForDirectory.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free