MCPcopy Create free account
hub / github.com/Martian-Engineering/pr-sheriff / writeJsonCache

Function writeJsonCache

src/github/file_cache.mjs:45–51  ·  view source on GitHub ↗
({ cacheDir, key, value })

Source from the content-addressed store, hash-verified

43 * Write JSON cache entry atomically.
44 */
45export function writeJsonCache({ cacheDir, key, value }) {
46 ensureDir(cacheDir);
47 const filePath = cachePath(cacheDir, key);
48 const tmpPath = `${filePath}.tmp.${process.pid}`;
49 fs.writeFileSync(tmpPath, `${JSON.stringify(value, null, 2)}\n`, 'utf-8');
50 fs.renameSync(tmpPath, filePath);
51}
52

Callers 4

#restPaginateArrayMethod · 0.90
#restPaginateSearchMethod · 0.90
#restRequestMethod · 0.90
#graphqlPaginateNodesMethod · 0.90

Calls 2

ensureDirFunction · 0.85
cachePathFunction · 0.85

Tested by

no test coverage detected