esp_clear_cache: Clear your 'mapSpain' cache dir

View source: R/esp-cache.R

esp_clear_cacheR Documentation

Clear your mapSpain cache dir

Description

Use this function with caution. It clears your cached data and configuration, specifically:

  • Deletes the mapSpain configuration directory (tools::R_user_dir("mapSpain", "config")).

  • Deletes the cache_dir directory and its contents.

  • Clears the value stored in Sys.getenv("MAPSPAIN_CACHE_DIR").

Usage

esp_clear_cache(config = FALSE, cached_data = TRUE, verbose = FALSE)

Arguments

config

logical. If TRUE, deletes the configuration folder of mapSpain.

cached_data

logical. If TRUE, deletes your cache_dir and all its contents.

verbose

logical. If TRUE displays informational messages.

Details

This is an aggressive function intended to reset your installation as if you had never installed or used mapSpain.

Value

Invisible. This function is called for its side effects.

See Also

tools::R_user_dir()

Other cache utilities: esp_set_cache_dir()

Examples


# Don't run this! It would modify your current state
## Not run: 
my_cache <- esp_detect_cache_dir()

# Set an example cache
ex <- file.path(tempdir(), "example", "cache")
esp_set_cache_dir(ex, verbose = FALSE)

# Restore initial cache
esp_clear_cache(verbose = TRUE)

esp_set_cache_dir(my_cache)
identical(my_cache, esp_detect_cache_dir())

## End(Not run)

mapSpain documentation built on Jan. 17, 2026, 9:07 a.m.