Skip to contents

Removes cached webR engines and, with versions = NULL, everything else webrarian keeps in its cache, such as downloaded WebAssembly packages and package indexes. The next build that bundles the engine downloads the ~40 MB engine again, so in an interactive session clearing the whole cache asks first. See "Package options" in ?webrarian for where the cache is.

Usage

webr_cache_clear(versions = NULL)

Arguments

versions

NULL (the default) to clear the whole cache, or a character vector of webR engine versions to remove (without asking).

Value

Invisibly, the paths removed. This is character() when nothing was, for example when you answer "no" or none of versions was cached.

Examples

# Use a throwaway cache for this example
old <- Sys.getenv("R_USER_CACHE_DIR", unset = NA)
Sys.setenv(R_USER_CACHE_DIR = file.path(tempdir(), "webrarian-cache-demo"))

webr_cache_info()
#> 
#> ── Webrarian Cache ──
#> 
#> Location: /tmp/RtmpQU25pJ/webrarian-cache-demo/R/webrarian
#> 
#> ℹ Cache directory does not exist
webr_cache_clear()
#> ℹ The cache is empty

if (is.na(old)) Sys.unsetenv("R_USER_CACHE_DIR") else Sys.setenv(R_USER_CACHE_DIR = old)