Skip to contents

Removes cached data files stored by this package. By default all cached files are deleted. Use max_age_days to remove only files older than a given number of days.

Usage

clear_cache(max_age_days = NULL)

Arguments

max_age_days

Numeric. If supplied, only files older than this many days are removed. If NULL (the default), all cached files are removed.

Value

Invisibly returns NULL. Called for its side effect of deleting cached files.

See also

Other data access: ons_get(), ons_search()

Examples

# \donttest{
op <- options(ons.cache_dir = tempdir())
clear_cache()
#> Warning: cannot remove file '/tmp/Rtmp6ApD8Y/bslib-8a92d22979ec96a3105b4f8cbcdeeec5', reason 'Directory not empty'
#> Warning: cannot remove file '/tmp/Rtmp6ApD8Y/downlit', reason 'Directory not empty'
#>  Removed 2 cached files.
options(op)
# }