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 try { const c = localStorage.getItem(key); return c ? JSON.parse(c) : {}; } catch { return {}; }
103}
104function setCache<T>(key: string, id: string, data: T) {
105 const cache = getCache<T>(key);
106 (cache as any)[id] = { data, timestamp: Date.now() };
107 localStorage.setItem(key, JSON.stringify(cache));
108}
109
110function ndviColor(val: number): string {
111 if (val > 0.6) return "hsl(var(--field-green, 140 40% 40%))";

Callers 2

fetchGrowthStageFunction · 0.85
fetchAiAnalysisFunction · 0.85

Calls 1

getCacheFunction · 0.85

Tested by

no test coverage detected