MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / readCache

Function readCache

packages/cli/src/registry/remote.ts:48–58  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

46}
47
48function readCache<T>(path: string): T | undefined {
49 try {
50 const entry = JSON.parse(readFileSync(path, "utf-8")) as CacheEntry<T>;
51 if (typeof entry.fetchedAt !== "number") return undefined;
52 if (Date.now() - entry.fetchedAt > CACHE_TTL_MS) return undefined;
53 return entry.data;
54 } catch {
55 // Missing file or corrupt JSON → cache miss.
56 return undefined;
57 }
58}
59
60function writeCache<T>(path: string, data: T): void {
61 try {

Callers 2

fetchRegistryManifestFunction · 0.85
fetchItemManifestFunction · 0.85

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected