argo_cache_dir: Get and set the default cache directory

Description Usage Arguments Value Examples

View source: R/argo-cache.R

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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

Examples

1
2
3
4
5
argo_cache_dir()

temp_dir <- tempfile()
with_argo_cache_dir(temp_dir, argo_cache_dir())
unlink(temp_dir, recursive = TRUE)

ArgoCanada/argodata documentation built on Dec. 13, 2021, 10:13 a.m.