Skip to contents

Use this function with caution. It clears cached data 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

Logical. If TRUE, delete the geobounds configuration directory.

cached_data

Logical. If TRUE, delete the active cache directory and all its contents.

quiet

Logical. If TRUE, suppress informational messages.

Value

invisible(). This function is called for its side effects.

Details

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

See also

Examples


# Caution: this may modify your current state.

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

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

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