Function
buildAnalyticsCacheKey
(coords: [number, number][], analyses: string[])
Source from the content-addressed store, hash-verified
| 18 | } |
| 19 | |
| 20 | function buildAnalyticsCacheKey(coords: [number, number][], analyses: string[]) { |
| 21 | const normalizedCoords = coords.map(([lon, lat]) => [Number(lon.toFixed(5)), Number(lat.toFixed(5))]); |
| 22 | return JSON.stringify({ coords: normalizedCoords, analyses: [...analyses].sort() }); |
| 23 | } |
| 24 | |
| 25 | function getCachedAnalytics(key: string, allowStale = false) { |
| 26 | const cached = analyticsCache.get(key); |
Tested by
no test coverage detected