wa_cache_clear: Clear writeAlizer's user cache

View source: R/cache.R

wa_cache_clearR Documentation

Clear writeAlizer's user cache

Description

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)

Arguments

ask

Logical; if TRUE and interactive, ask for confirmation.

preview

Logical; if TRUE and ask is TRUE, show a brief listing/size summary before asking.

Value

Invisibly returns TRUE if the cache was cleared (or already absent), FALSE if the user declined or deletion failed.

See Also

wa_cache_dir

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)
})

writeAlizer documentation built on Sept. 17, 2026, 1:08 a.m.