shibdib / Firetail

An EVE Online Discord Bot (Continuation of Dramiel)
MIT License
23 stars 22 forks source link

Tidy ESI API methods, Add caches for static info #150

Closed scragly closed 5 years ago

scragly commented 5 years ago

In preparation for working on the ESI API in more depth, I've tidied the existing API methods.

I've added basic data caches also for endpoints that are typically static:

On the first fetch, it'll load the data into the respective cache, and in future grabs, it'll return the cached data instead. The cache is memory-only, so will be empty on bot restart.

To accommodate cases where it's somehow imperative to get fresh data for any of these, there's a keyword argument of allow_cache which is True by default. When calling the cached methods, you can pass False for this kwarg and it'll always request it from the web API again, while also refreshing the cache data with the newly retrieved data.