Change caching settings for the package. By default, the cache will be set to keep the results of function calls in memory to reduce the number of requests made to online services for the same data. However, if preferred, the cache can be set to a file directory to make the results persist between sessions.
This is a particularly good idea if you're using functions like load_driver_telemetry()
,
load_session_laps()
, load_race_session()
or plot_fastest()
as they take
significant time and download large amounts of data each time you run the function.
If preferred for testing or waiting for data updates on race weekends, you may wish to
set the cache to 'off'
instead.
Changes to cache can be made for the session (mark the argument persist
as FALSE
)
or apply to the next session(s) by setting persist
to TRUE
Arguments
- cache
One of
'memory'
,'filesystem'
,'off'
or a directory.If the selection is
'filesystem'
the package will automatically write the cache to the operating system's default location for permanent or temporary caches (seepersist
)- create_dir
Whether to create the directory if it doesn't already exist if a path cache directory is provided. By default this doesn't occur for provided cache paths, but will always happen if the cache choice is set to
'filesystem'
.- persist
Whether to make this change permanent (
TRUE
) or a temporary cache change only (default,FALSE
). Note if you setcache
to'off'
andpersist
toTRUE
the existing cache will be cleared by callingclear_cache()
.If
filesystem
is chosen forcache
andpersist
is set toTRUE
, then a cache directory will be placed in the default location for the operating system. If insteadpersist
is set toFALSE
, then a temporary directory will be used instead, and this will be removed at the end of the session. This essentially has the same effect as havingcache
set to'memory'
.