drake (version 6.2.1)

new_cache: Make a new drake cache.

Description

Uses the storr_rds() function from the storr package.

Usage

new_cache(path = drake::default_cache_path(),
  verbose = drake::default_verbose(), type = NULL,
  short_hash_algo = drake::default_short_hash_algo(),
  long_hash_algo = drake::default_long_hash_algo(), ...,
  console_log_file = NULL)

Arguments

path

file path to the cache if the cache is a file system cache.

verbose

logical or numeric, control printing to the console. Use pkgconfig to set the default value of verbose for your R session: for example, pkgconfig::set_config("drake::verbose" = 2).

  • 0 or FALSE: print nothing.

  • 1 or TRUE: print only targets to build.

  • 2: also print checks and cache info.

  • 3: also print any potentially missing items.

  • 4: also print imports and writes to the cache.

type

deprecated argument. Once stood for cache type. Use storr to customize your caches instead.

short_hash_algo

short hash algorithm for the cache. See default_short_hash_algo() and make()

long_hash_algo

long hash algorithm for the cache. See default_long_hash_algo() and make()

...

other arguments to the cache constructor

console_log_file

character scalar, connection object (such as stdout()) or NULL. If NULL, console output will be printed to the R console using message(). If a character scalar, console_log_file should be the name of a flat file, and console output will be appended to that file. If a connection object (e.g. stdout()) warnings and messages will be sent to the connection. For example, if console_log_file is stdout(), warnings and messages are printed to the console in real time (in addition to the usual in-bulk printing after each target finishes).

Value

A newly created drake cache as a storr object.

See Also

default_short_hash_algo(), default_long_hash_algo(), make()

Examples

Run this code
# NOT RUN {
test_with_dir("Quarantine new_cache() side effects.", {
clean(destroy = TRUE) # Should not be necessary.
unlink("not_hidden", recursive = TRUE) # Should not be necessary.
cache1 <- new_cache() # Creates a new hidden '.drake' folder.
cache2 <- new_cache(path = "not_hidden", short_hash_algo = "md5")
clean(destroy = TRUE, cache = cache2)
})
# }

Run the code above in your browser using DataCamp Workspace