Map tiles are cached on disk for as long as the server's caching headers
allow (a day when they say nothing), so repeated renders of an area do
not download them again. The cache starts in BASEMAPPER_CACHE_DIR when
that is set ("off" disables it), else in
tools::R_user_dir("basemapper", "cache"). Set BASEMAPPER_CACHE_DIR in
.Renviron (usethis::edit_r_environ() opens it) to keep a folder for good,
or to share one cache with Python.
Usage
tile_cache(dir = NULL, clear = FALSE, max_size = NULL)
Arguments
- dir
A directory to move the cache to, or FALSE to turn it off.
NULL leaves it as it is.
- clear
Delete every cached tile.
- max_size
The cache's size limit in megabytes (NULL leaves it as
it is).
Value
The cache directory, or NULL when the cache is off (invisibly
when dir or clear is given).
Details
The cache is kept small: expired tiles are deleted, and past its size
limit (250 MB, or BASEMAPPER_CACHE_MAX_SIZE in MB) the least recently
used tiles go first, in the background as tiles are stored. Python:
basemapper.tile_cache().
Examples
tile_cache()
#> [1] "/home/runner/.cache/R/basemapper"