You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#' @param max_size the size of the entire cache, in MB, at which to start pruning entries. By default this is `1024`, or 1GB. The environmental variable is `EPIDATR_CACHE_MAX_SIZE_MB`.
55
55
#' @param logfile where cachem's log of transactions is stored, relative to the cache directory. By default, it is `"logfile.txt"`. The environmental variable is `EPIDATR_CACHE_LOGFILE`.
56
56
#' @param prune_rate how many calls to go between checking if any cache elements are too old or if the cache overall is too large. Defaults to `2000L`. Since cachem fixes the max time between prune checks to 5 seconds, there's little reason to actually change this parameter. Doesn't have a corresponding environmental variable.
57
+
#' @param confirm whether to confirm directory creation. default is `TRUE`; should only be set in scripts
57
58
#' @export
58
59
#' @import cachem
59
60
set_cache<-function(cache_dir=NULL,
60
61
days=NULL,
61
62
max_size=NULL,
62
63
logfile=NULL,
63
-
prune_rate=2000L) {
64
+
prune_rate=2000L,
65
+
confirm=TRUE) {
64
66
if (is.null(cache_dir) && sessionInfo()$R.version$major>=4) {
user_input<- readline(glue::glue("there is no directory at {cache_dir}; the cache will be turned off until a viable directory has been set. Create one? (yes|no) "))
user_input<- readline(glue::glue("there is no directory at {cache_dir}; the cache will be turned off until a viable directory has been set. Create one? (yes|no) "))
cli::cli_warn("using cached results with `as_of` within the past week (or the future!). This will likely result in an invalid cache. Consider
190
188
1. disabling the cache for this session with `disable_cache` or permanently with environmental variable `EPIDATR_USE_CACHE=FALSE`
191
189
2. setting `EPIDATR_CACHE_MAX_AGE_DAYS={Sys.getenv('EPIDATR_CACHE_MAX_AGE_DAYS', unset = 1)}` to e.g. `3/24` (3 hours).",
192
190
.frequency="regularly",
193
-
.frequency_id="cache timing issues"
191
+
.frequency_id="cache timing issues",
192
+
class="cache_recent_data"
194
193
)
195
194
}
196
195
if (!is.key_missing(cached)) {
197
196
cli::cli_warn("loading from the cache at {cache_environ$epidatr_cache$info()$dir}; see {cache_environ$epidatr_cache$info()$logfile} for more details.",
0 commit comments