ttytm/wthrr-the-weathercrab

weather data cache

molingyu opened this issue · 4 comments

I hope to support weather data caching.

Use an validity value to ensure cache timeliness.

This is very helpful for users with poor network conditions.

ttytm commented

Hey @molingyu, thanks for reaching out.

The forecast data that's fetched for a location is below 10kb. The request for the city name is roughly 500Bytes. In cases when someone requests forecasts for the same location within the same hour, that's probably all what we would save with a cache.

The major bottleneck might be that we are using a freely available API with a growing user base. I don't know how scalable it is yet or about potential downtimes. We could add other weather forecast providers, including those that require an API key that a user could put in the configuration file.

I think adding support for user-defined APIs is a great way to go, but I'm unsure of the what the best implementation would be.

We should have a wrapper for weather data source.

In this way, we can support multiple weather data sources, and users can choose the one that is more suitable for them (e.g users in some regions can use local official data sources to obtain more accurate, faster and stable weather data), and the community can also contribute new data source. I'm not too sure about the need for a plugin system for data sources.

BTW, I recommend creating a new issue for the data source.

ttytm commented

Great, let's continue there. Concrete concepts and PRs would be of tremendous help, it's going to be hard to put much work into new features myself in the next few weeks.