gb_clear_cache: Clear the 'geobounds' cache directory

View source: R/gb-cache.R

gb_clear_cacheR Documentation

Clear the geobounds cache directory

Description

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.

Details

This reset restores the cache state of a fresh geobounds installation. For safety, the function refuses to recursively delete a cache path that contains the home, working, temporary or package configuration directory. Use a dedicated cache subdirectory. Inspect the active directory with gb_detect_cache_dir() before clearing it. Use gb_set_cache_dir() to configure a cache directory again.

Value

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

See Also

Cache management functions: gb_detect_cache_dir(), gb_set_cache_dir()

Examples


# Caution: this may modify your current state.

## Not run: 
my_cache <- gb_detect_cache_dir()
# Set an example cache directory.
ex <- file.path(tempdir(), "example", "cache")
gb_set_cache_dir(ex, quiet = TRUE)

gb_clear_cache(quiet = FALSE)

# Restore the initial cache.
gb_set_cache_dir(my_cache)
identical(my_cache, gb_detect_cache_dir())

## End(Not run)

geobounds documentation built on Sept. 6, 2026, 1:06 a.m.