athuler / PassioGo

An unofficial API for the Passio Go transportation system
https://pypi.org/project/PassioGo/
MIT License
4 stars 3 forks source link

Caching #27

Open dmv1167 opened 2 months ago

dmv1167 commented 2 months ago

I have separated the caching mechanism I came up with into this branch. I understand if this isn't what you had in mind as the caches are stored with each object, and I'm willing to try to implement time based refreshing in some manner in the future.

dmv1167 commented 1 month ago

You may need to merge 0.3.0 into this branch as well

dmv1167 commented 1 month ago

That looked awfully messy but this PR should include 0.3.0 changes.

I made the caches into dictionaries to allow for instant lookups when using any getById() method. In the case of System, caches are automatically populated the first time the API is called, and still must be repopulated manually using refresh().