Drop orphaned entries from the nlmixr2targets indirect cache
Source: R/indirection.R
nlmixr2targets_cache_prune.RdRemoves cache entries whose md5 hash is not in keep. By default
dry_run = TRUE, so the function reports what would be removed without
actually deleting anything; pass dry_run = FALSE to delete.
Usage
nlmixr2targets_cache_prune(
keep = NULL,
dry_run = TRUE,
directory = file.path(targets::tar_config_get("store"), "user/nlmixr2")
)Arguments
- keep
Character vector of md5 hashes to retain. If
NULL(default), the helper auto-discovers reachable hashes from thetargetsmetadata in the current store. Set tocharacter()to treat every cached entry as an orphan.- dry_run
Logical. If
TRUE(default), do not delete anything; just return the hashes that would be removed. IfFALSE, delete.- directory
Cache directory; same default as
nlmixr2targets_cache_status().
Value
Invisibly, a character vector of the orphan hashes (those that
were removed when dry_run = FALSE, or would be removed otherwise).
Details
When keep = NULL, the function reads the targets metadata in the
current store and treats every value of a built target whose name ends
in _object_simple (the hashes produced by nlmixr_object_simplify())
as reachable. Pass an explicit character vector if you want to override
that, e.g. before calling targets::tar_destroy() yourself.