Skip to contents

Use this function with caution. It clears cached archives and configuration by deleting the geobounds configuration directory returned by tools::R_user_dir(), deleting the active cache directory and clearing the GEOBOUNDS_CACHE_DIR environment variable. See base::Sys.getenv().

Usage

gb_clear_cache(config = FALSE, cached_data = TRUE, quiet = TRUE)

Arguments

config

A logical value. If TRUE, delete the geobounds configuration directory.

cached_data

A logical value. If TRUE, delete the active cache directory and all its contents.

quiet

A logical value. If TRUE, suppress informational messages.

Value

Invisibly returns NULL. This function is called for its side effects.

Details

This reset restores the cache state of a fresh geobounds installation.

See also

Cache management functions: gb_detect_cache_dir(), gb_set_cache_dir()

Examples


# Caution: this may modify your current state.

# \dontrun{
my_cache <- gb_detect_cache_dir()
#>  /tmp/RtmpwuBf6K/geobounds
# Set an example cache directory.
ex <- file.path(tempdir(), "example", "cache")
gb_set_cache_dir(ex, quiet = TRUE)

gb_clear_cache(quiet = FALSE)
#>  Deleted the geobounds cache directory /tmp/RtmpwuBf6K/example/cache.

# Restore the initial cache.
gb_set_cache_dir(my_cache)
#>  geobounds cache directory is /tmp/RtmpwuBf6K/geobounds.
#>  To use this cache directory in future sessions, call `gb_set_cache_dir()` with `install = TRUE`.
identical(my_cache, gb_detect_cache_dir())
#>  /tmp/RtmpwuBf6K/geobounds
#> [1] TRUE
# }