Skip to content

Conversation

@sisimomo
Copy link

@sisimomo sisimomo commented Oct 6, 2024

  • Greatly improved code structure by refactoring logic into multiple functions for better readability.
  • Implement cache mechanism for the OpenWeather API responses, reducing unnecessary API calls.

…factor code structure for better readability


- Greatly improved code structure by refactoring logic into multiple functions for better readability.
- Implement cache mechanism for the OpenWeather API responses, reducing unnecessary API calls.
@MarcLandis
Copy link
Owner

Thanks for your contribution. Could you please explain under what circumstances a caching is needed?

@sisimomo
Copy link
Author

sisimomo commented Nov 9, 2024

Hi, yes, definitely. It's mostly useful when you have multiple MagicMirror clients (monitors) powered by the same MagicMirror backend (server). That way, you can ensure that your OpenWeather API usage doesn’t scale up when serving more clients.

@sisimomo
Copy link
Author

I have been using it for the past two months on 2 Mirror, and it seems to work very reliably.

@MarcLandis, could you consider merging it if you think it’s good? Alternatively, please let me know what I could improve to meet your expectations.

@MaxDiOrio
Copy link

Would this also be beneficial if you have multiple modules on the same screen? I was just setting this up and was going to submit a request to cache the data so a screen with two modules doesn't make multiple API calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants