schachmat / wego

weather app for the terminal
ISC License
7.81k stars 475 forks source link

Data caching required to reduce API calls #196

Open VinVorteX opened 1 week ago

VinVorteX commented 1 week ago

Implement caching to reduce the number of API calls, especially if the user requests the same location multiple times.

VinVorteX commented 1 week ago

i would like to work on this feature

kordianbruck commented 1 week ago

I think the question is: is any of the api vendors actually complaining or are we doing this for users, because they are running into quota issue?

kordianbruck commented 1 week ago

Also: why don't we persist the cache into /tmp or disk at least? It seems that would be more useful as a long term solution that just an in-memory cache.

VinVorteX commented 1 week ago

For the API vendors, I think we’re mainly doing this for users who might run into quota issues. We want to help them avoid hitting those limits, even if the vendors aren’t complaining right now.

As for caching, using in-memory caching was a quick and simple solution for speed. It’s great for short-term use since weather data changes often. But I totally agree that persisting the cache in /tmp or on disk would be a better long-term solution. It would help users keep data across sessions and reduce loading times. I can definitely look into adding that feature in the future!

kordianbruck commented 1 week ago

As a oneshot terminal CLI in-memory cache does nothing. Once the program terminates, the cache is gone. So as implemented the code does nothing to my understanding. Without file persistence this makes no sense to me.