Skip to contents

Removes files fetched from data repositories by data_check / code_check from the on-disk cache (see repo_cache_dir()). The cache only speeds up re-runs — anything deleted is simply re-downloaded when next needed — so clearing it is always safe; the usual reason is to reclaim disk space after a large corpus build.

Usage

repo_cache_clear(repo_url = NULL, quiet = FALSE)

Arguments

repo_url

optional character vector of repository URLs. When supplied, only those repositories' cached files are deleted; otherwise the entire cache is cleared.

quiet

if FALSE (default), report how much was freed.

Value

the number of bytes freed (numeric), invisibly.

Details

By default the whole cache is removed. Pass repo_url to remove only the cached files of specific repositories.

Examples

# a cache in a temporary folder, so no real cache is cleared
old <- options(metacheck.repo_cache.dir = file.path(tempdir(), "repo_cache"))
repo_cache_clear()
#> Cleared the repository file cache (0 bytes freed).

# clear one repository only
repo_cache_clear("https://osf.io/abcde")
#> Cleared 0 cached repositories (0 bytes freed).
options(old)