Closed m-muecke closed 1 week ago
What sort of example are you looking for?
Currently the docs mention using unlink(dir(cache_path, full.names = TRUE)
or tempdir()
for the path arg. Would be great to have a sentence or example for using it inside a package with tools::R_user_dir
. Perhaps something similar to what I've found in the pkgdown package:
req_pkgdown_cache <- function(req) {
cache_path <- dir_create(path(tools::R_user_dir("pkgdown", "cache"), "http"))
httr2::req_cache(
req,
path = cache_path,
max_age = 86400 # 1 day
)
}
req_cache()
already has an example with usingtempdir()
as the path, would be great to have an example for using it withtools::R_user_dir("pgk", "cache")
like done in the pkgdown package and others