mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00

This adds a garbage collector which will remove old files from cargo's global cache. A general overview of the changes here: - `cargo::core::global_cache_tracker` contains the `GlobalCacheTracker` which handles the interface to a sqlite database which stores timestamps of the last time a file was used. - `DeferredGlobalLastUse` is a type that implements an optimization for collecting last-use timestamps so that they can be flushed to disk all at once. - `cargo::core::gc` contains the `Gc` type which is the interface for performing garbage collection. It coordinates with the `GlobalCacheTracker` for determining what to delete. - Garbage collection can either be automatic or manual. The automatic garbage collection supports some config options for defining when it runs and how much it deletes. - Manual garbage collection can be performed via options to `cargo clean`. - `cargo clean` uses the new package cache locking system to coordinate access to the package cache to prevent interference with other cargo commands running concurrently.