MCPcopy Create free account
hub / github.com/Thanas-R/Virdis / setCache

Function setCache

src/components/FieldDetailView.tsx:104–108  ·  view source on GitHub ↗
(key: string, id: string, data: T)

Source from the content-addressed store, hash-verified

102}
103
104function getCache<T>(key: string): Record<string, { data: T; timestamp: number }> {
105 try { const c = localStorage.getItem(key); return c ? JSON.parse(c) : {}; } catch { return {}; }
106}
107function setCache<T>(key: string, id: string, data: T) {
108 const cache = getCache<T>(key);
109 (cache as any)[id] = { data, timestamp: Date.now() };
110 localStorage.setItem(key, JSON.stringify(cache));
111}

Callers 2

fetchGrowthStageFunction · 0.85
fetchAiAnalysisFunction · 0.85

Calls 1

getCacheFunction · 0.85

Tested by

no test coverage detected