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

Function setCache

packages/node-runtime/src/cache/session-cache.ts:56–61  ·  view source on GitHub ↗
(sessionId: string, key: string, data: T, cacheDir: string)

Source from the content-addressed store, hash-verified

54}
55
56export function setCache<T>(sessionId: string, key: string, data: T, cacheDir: string): void {
57 const cachePath = getCachePath(sessionId, cacheDir)
58 const file = readCacheFile(cachePath) ?? {}
59 file[key] = { data, ts: Math.floor(Date.now() / 1000) }
60 writeCacheFile(cachePath, file)
61}
62
63export function invalidateCache(sessionId: string, cacheDir: string, key?: string): void {
64 const cachePath = getCachePath(sessionId, cacheDir)

Calls 4

getCachePathFunction · 0.85
readCacheFileFunction · 0.85
writeCacheFileFunction · 0.85
nowMethod · 0.45

Tested by

no test coverage detected