drake (version 6.2.1)

drake_gc: Do garbage collection on the drake cache.

Description

The cache is a key-value store. By default, the clean() function removes values, but not keys. Garbage collection removes the remaining dangling files.

Usage

drake_gc(path = getwd(), search = TRUE,
  verbose = drake::default_verbose(), cache = NULL, force = FALSE)

Arguments

path

Root directory of the drake project, or if search is TRUE, either the project root or a subdirectory of the project. Ignored if a cache is supplied.

search

logical. If TRUE, search parent directories to find the nearest drake cache. Otherwise, look in the current working directory only. Ignored if a cache is supplied.

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.

cache

drake cache. See new_cache(). If supplied, path and search are ignored.

force

logical, whether to load the cache despite any back compatibility issues with the running version of drake.

Value

NULL

See Also

clean()

Examples

Run this code
# NOT RUN {
test_with_dir("Quarantine side effects.", {
load_mtcars_example() # Get the code with drake_example("mtcars").
make(my_plan) # Run the project, build the targets.
# At this point, check the size of the '.drake/' cache folder.
# Clean without garbage collection.
clean(garbage_collection = FALSE)
# The '.drake/' cache folder is still about the same size.
drake_gc() # Do garbage collection on the cache.
# The '.drake/' cache folder should have gotten much smaller.
})
# }

Run the code above in your browser using DataLab