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

Function setLocalCache

src/lib/query-cache.ts:15–19  ·  view source on GitHub ↗
(key: string, id: string, data: T)

Source from the content-addressed store, hash-verified

13}
14
15export function setLocalCache<T>(key: string, id: string, data: T) {
16 const cache = getLocalCache<T>(key);
17 cache[id] = { data, timestamp: Date.now() };
18 localStorage.setItem(key, JSON.stringify(cache));
19}
20
21export function getFreshLocalCacheValue<T>(key: string, id: string, ttlMs: number): T | null {
22 const cache = getLocalCache<T>(key);

Callers 7

fetchSoilFunction · 0.90
fetchNdviStatsFunction · 0.90
fetchGeeFunction · 0.90
fetchTsFunction · 0.90
fetchSoilFunction · 0.90
fetchGeeFunction · 0.90
fetchTsFunction · 0.90

Calls 1

getLocalCacheFunction · 0.85

Tested by

no test coverage detected