Deletes all files under wa_cache_dir(). If ask = TRUE and in an
interactive session, a short preview (item count, total size, and up to 10 sample
paths) is printed before asking for confirmation. In a non-interactive script,
no prompt is shown, even if ask = TRUE. Use this only on a dedicated
cache folder; all its contents are removed.
Usage
wa_cache_clear(ask = interactive(), preview = TRUE)Value
Invisibly returns TRUE if the cache was cleared (or already absent),
FALSE if the user declined or deletion failed.
Examples
local({
old <- options(writeAlizer.cache_dir = tempfile("wa-cache-"))
on.exit(options(old))
dir.create(wa_cache_dir())
on.exit(unlink(wa_cache_dir(), recursive = TRUE), add = TRUE, after = FALSE)
writeLines("demo", file.path(wa_cache_dir(), "demo.txt"))
wa_cache_clear(ask = FALSE)
})
#> Cleared cache: /tmp/RtmphX38qe/wa-cache-186e305331f3