MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / writeCacheFile

Function writeCacheFile

packages/node-runtime/src/cache/session-cache.ts:37–47  ·  view source on GitHub ↗
(cachePath: string, content: CacheFile)

Source from the content-addressed store, hash-verified

35}
36
37function writeCacheFile(cachePath: string, content: CacheFile): void {
38 try {
39 const dir = path.dirname(cachePath)
40 if (!fs.existsSync(dir)) {
41 fs.mkdirSync(dir, { recursive: true })
42 }
43 fs.writeFileSync(cachePath, JSON.stringify(content), 'utf-8')
44 } catch {
45 // Write failure is non-fatal
46 }
47}
48
49export function getCache<T>(sessionId: string, key: string, cacheDir: string): T | null {
50 const cachePath = getCachePath(sessionId, cacheDir)

Callers 2

setCacheFunction · 0.85
invalidateCacheFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected