cacheName: Tool: cacheName

View source: R/cacheName.R

cacheNameR Documentation

Tool: cacheName

Description

Load fitting cache data (if available)

Usage

cacheName(
  prefix,
  type,
  args = NULL,
  graph = NULL,
  mode = "put",
  packages = getConfig("packages"),
  globalenv = getConfig("globalenv")
)

Arguments

prefix

function prefix (e.g. "calc" or "read")

type

output type (e.g. "TauTotal")

args

a list of named arguments used to call the given function

graph

A madrat graph as returned by getMadratGraph. Will be created with getMadratGraph if not provided.

mode

Context in which the function is used. Either "get" (loading) or "put" (writing). In case of "put" the potential file name is returned. When set to "get", a file name will only be returned if the file exists (otherwise NULL) and in combination which setConfig(forcecache=TRUE) even a cache file with deviating hash might get selected.

packages

A character vector with packages for which the available Sources/Calculations should be returned

globalenv

Boolean deciding whether sources/calculations in the global environment should be included or not

Value

Name of fitting cache file, if available, otherwise NULL

Note

setConfig(forcecache=TRUE) strongly affects the behavior of cacheName. In read model it will also return cache names with deviating hashes if no fitting cache file is found (in that case it will just return the newest one). In write mode the hash in the name will be left out since due to cache forcing it cannot be guaranteed that the cache file agrees with the state represented by the hash.

Author(s)

Jan Philipp Dietrich

See Also

cachePut, cacheName

Examples

madrat:::cacheName("calc", "TauTotal")

madrat documentation built on Aug. 23, 2023, 5:10 p.m.