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

Function getFreshLocalCacheValue

src/lib/query-cache.ts:21–26  ·  view source on GitHub ↗
(key: string, id: string, ttlMs: number)

Source from the content-addressed store, hash-verified

19}
20
21export function getFreshLocalCacheValue<T>(key: string, id: string, ttlMs: number): T | null {
22 const cache = getLocalCache<T>(key);
23 const entry = cache[id];
24 if (!entry) return null;
25 return Date.now() - entry.timestamp < ttlMs ? entry.data : null;
26}
27
28export function isFallbackPayload(value: unknown): value is { fallback: true; error?: string; message?: string } {
29 return !!value && typeof value === "object" && (value as { fallback?: boolean }).fallback === true;

Callers 4

FieldDetailViewFunction · 0.90
fetchNdviStatsFunction · 0.90
WeatherViewFunction · 0.90
FieldComparisonColumnFunction · 0.90

Calls 1

getLocalCacheFunction · 0.85

Tested by

no test coverage detected