Skip to contents

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

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/RtmpMujlMf/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/RtmpMujlMf/example/cache.

# Restore the initial cache.
gb_set_cache_dir(my_cache)
#>  geobounds cache directory is /tmp/RtmpMujlMf/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/RtmpMujlMf/geobounds
#> [1] TRUE
# }