The cache directory stores previously downloaded files to access them more quickly. The cache directory stores files in the same format as a an argo_mirror(). By default, the cache is stored in a temporary directory that is cleared when the session is restarted. This ensures access to the latest index and files by default.

argo_cache_dir()

argo_update_global(max_global_cache_age = -Inf, all = TRUE, quiet = FALSE)

argo_update_data(max_data_cache_age = -Inf, quiet = FALSE)

argo_set_cache_dir(cache_dir)

with_argo_cache_dir(cache_dir, expr)

with_argo_example_cache(expr)

argo_cached(path)

argo_test_mirror()

Arguments

max_global_cache_age

The maximum age in hours to keep cached files. Use Inf to always use cached files; use -Inf to always force download. You can set the default values of these using options(argodata.max_global_cache_age = ...) and/or options(argodata.max_data_cache_age = ...).

all

Should index files be downloaded even if they have not been previously downloaded?

quiet

Use FALSE to show which files are downloaded and for more verbose error messages.

max_data_cache_age

The maximum age in hours to keep cached files. Use Inf to always use cached files; use -Inf to always force download. You can set the default values of these using options(argodata.max_global_cache_age = ...) and/or options(argodata.max_data_cache_age = ...).

cache_dir

A writable directory in which downloaded files can be cached.

expr

An expression to be evaluated with the specified default cache_dir.

path

A path relative to the root directory of argo_mirror() or argo_cache_dir(). This value can also be a data.frame with a file column (e.g., a global index as returned by argo_global_meta() and others).

Value

  • argo_cache_dir(): The directory where cache files are located

  • argo_set_cache_dir(): The previously set cache directory

  • with_argo_cache_dir(), with_argo_example_cache(): The result of expr.

  • argo_cached(): The file path to the cached version of the Argo file (which may or may not exist).

  • argo_update_data(), argo_update_global(): The locations of the updated files.

Examples

argo_cache_dir()
#> [1] "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmplUwcZ6/file8b4e1e9558be"

temp_dir <- tempfile()
with_argo_cache_dir(temp_dir, argo_cache_dir())
#> [1] "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmplUwcZ6/file8b4e5f6c12e9"
unlink(temp_dir, recursive = TRUE)