Expand description
Support for garbage collecting unused files from downloaded files or artifacts from the target directory.
The Gc type provides the high-level interface for the
garbage-collection system.
Garbage collection can be done βautomaticallyβ by cargo, which it does by
default once a day when running any command that does a lot of work (like
cargo build). The entry point for this is the auto_gc function,
which handles some basic setup, creating the Gc, and calling
Gc::auto.
Garbage collection can also be done manually via the cargo clean command
by passing any option that requests deleting unused files. That is
implemented by calling the Gc::gc method.
Garbage collection for the global cache is guided by the last-use tracking
implemented in the crate::core::global_cache_tracker module. See that
module documentation for an in-depth explanation of how global cache
tracking works.
StructsΒ§
- Auto
Config πAutomatic garbage collection settings from thegc.autoconfig table. - Garbage collector.
- Options to use for garbage collection.
ConstantsΒ§
- How often auto-gc will run by default unless overridden in the config.
- Default max ago to auto-clean cache data, which must be downloaded to recover.
- Default max age to auto-clean extracted sources, which can be recovered without downloading anything.
FunctionsΒ§
- Performs automatic garbage collection.
- auto_
gc_ πinner - maybe_
newer_ πspan Returns whicheverDurationis shorter. - Parses a time span string.
- Returns the shorter duration from
cur_spanversusconfig_span. - parse_
frequency πParses a frequency string. - Parses a file size using metric or IEC units.
- Parses a time span string.
- Parses a time span value fetched from config.