-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Right now we use the same temporary filename for each downloaded phylopic, which means that when you download the next phylopic, the old file is now gone. This is generally fine when you have fast/unlimited internet or are using few phylopics, but for plots with 10s to 100s of phylopics, you then have to download all of those phylopics again every time you iterate a plot or make a new plot. This means all of the time and bandwidth you spent downloading has been wasted.
Ideally, we should cache all of these files (they have unique IDs and file types, so there shouldn't be any conflicts). It looks like the httpcache package would be easy to implement (it just wraps httr and substitutes the functions with its own caching versions). Alternatively, httr2 has caching, so we could look into upgrading to that (although I imagine that would be more work).
The only downside with caching all of these files could be a large (and constantly growing) temporary file directory if you keep your session open for a while (httr2 has nifty options to only keep n files or a max of n bytes). So perhaps there should be an option to disable this behavior?