SCasanova / f1dataR

An R package to access Formula 1 Data from the Ergast API and the unofficial F1 data stream via the fastf1 python library.
https://scasanova.github.io/f1dataR/
Other
52 stars 5 forks source link

Cache-Change function? #170

Closed pbulsink closed 1 year ago

pbulsink commented 1 year ago

Instead of trying to manage cache behaviour (including checking for directory's existence, changing option to a directory instead of 'filesystem', etc.) in .onLoad() and .onAttach(), we may want to do this in a function that can be called by a user to update their cache preference.

The need for this has been evidenced by the fact that we can't test different cache strategies (besides "memory" which is the default) because we can't force a re-run of .onLoad() or .onAttach(). So if a user changes the cache option, we have no control on what happens with respect to anything in the file system. Changing from "memory" to "off" also doesn't stop updating the cache until the next R session is started, or the package is unloaded and reloaded.

SCasanova commented 1 year ago

Hmm that makes sense. The way I see it we have two options. Implement a function that does that or include a message that indicates that users should restart the R session when they modify their options

pbulsink commented 1 year ago

Added to #171