Learn R Programming

writeAlizer (version 1.7.2)

wa_cache_dir: Path to writeAlizer's user cache

Description

Returns the directory used to store cached model artifacts. By default this is a platform-appropriate user cache path from tools::R_user_dir("writeAlizer","cache"). If the option writeAlizer.cache_dir is set to a non-empty string, that location is used instead. This makes it easy to redirect the cache during tests or examples (e.g., to tempdir()).

Usage

wa_cache_dir()

Arguments

Value

Character scalar path.

See Also

wa_cache_clear

Examples

Run this code
# Inspect the cache directory (no side effects)
wa_cache_dir()

# \dontshow{
# Safe demo: redirect cache to a temp folder, create a file, then clear it
old <- getOption("writeAlizer.cache_dir"); on.exit(options(writeAlizer.cache_dir = old), add = TRUE)
tmp <- file.path(tempdir(), "wa_cache_demo"); dir.create(tmp, recursive = TRUE, showWarnings = FALSE)
options(writeAlizer.cache_dir = tmp)
writeLines("demo", file.path(wa_cache_dir(), "demo.txt"))
wa_cache_clear(ask = FALSE)
# }

Run the code above in your browser using DataLab