Cache response from yr.no
Erb3 opened this issue · comments
Erb3 commented
Added in #354, the weather source is yr.no. Yr requires that the responses from their API are cached. We should narrow down the coordinates to a bigger area, then cache it in Redis for a few hours. Redis supports expiry of values, which is nice.
I've separated it into smaller tasks:
- Make redis available to
weather.ts
route - Make sure redis is still available to
middleware.ts
- Remove a few decimals from the coordinates for them to be less accurate and cover a bigger area
- Store the coordinates and
summary
,max_temp
andmin_temp
in redis. Expire after a few hours. - On request to weather API, check if we have a cached version of the response, if so return that
- Document this
To be clear, I am not suggesting that all of these changes have their own PR, all of them should be in one PR.