You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[target-applies-to-host](#target-applies-to-host) --- Alters whether certain flags will be passed to host build targets.
88
+
*[gc](#gc) --- Global cache garbage collection.
88
89
* rustdoc
89
90
*[rustdoc-map](#rustdoc-map) --- Provides mappings for documentation to link to external sites like [docs.rs](https://docs.rs/).
90
91
*[scrape-examples](#scrape-examples) --- Shows examples within documentation.
@@ -1665,6 +1666,66 @@ version = "0.1.0"
1665
1666
workspace = true
1666
1667
```
1667
1668
1669
+
## gc
1670
+
1671
+
* Tracking issue: TODO
1672
+
1673
+
The `-Zgc` flag enables garbage-collection within cargo's global cache within the cargo home directory.
1674
+
This includes downloaded dependencies such as compressed `.crate` files, extracted `src` directories, registry index caches, and git dependencies.
1675
+
When `-Zgc` is present, cargo will track the last time any file was used, and then uses those timestamps to manually or automatically delete files that have not been used for a while.
1676
+
1677
+
```sh
1678
+
cargo build -Zgc
1679
+
```
1680
+
1681
+
Automatic deletion happens on commands that are already doing a significant amount of work,
1682
+
such as all of the build commands (`cargo build`, `cargo test`, `cargo check`, etc.), and `cargo fetch`.
1683
+
Automatic deletion is only done once per day.
1684
+
Automatic deletion is disabled if cargo is offline such as with`--offline` or `--frozen` to avoid deleting files that may need to be used if you are offline for a long period of time.
1685
+
1686
+
Manual deletion can be done with the `cargo clean` command.
1687
+
Deletion of cache contents can be performed by passing one of the cache options:
1688
+
1689
+
-`--gc`--- Performs the same garbage collection that is performed by the once-a-day automatic deletion.
1690
+
-`--max-src-age=DURATION`--- Deletes source cache files that have not been used since the given age.
1691
+
-`--max-crate-age=DURATION`--- Deletes crate cache files that have not been used since the given age.
1692
+
-`--max-index-age=DURATION`--- Deletes registry indexes that have not been used since then given age (including their `.crate` and `src` files).
1693
+
-`--max-git-co-age=DURATION`--- Deletes git dependency checkouts that have not been used since then given age.
1694
+
-`--max-git-db-age=DURATION`--- Deletes git dependency clones that have not been used since then given age.
1695
+
-`--max-download-age=DURATION`--- Deletes any downloaded cache data that has not been used since then given age.
1696
+
-`--max-src-size=SIZE`--- Deletes the oldest source cache files until the cache is under the given size.
1697
+
-`--max-crate-size=SIZE`--- Deletes the oldest crate cache files until the cache is under the given size.
1698
+
-`--max-git-size=SIZE`--- Deletes the oldest git dependency caches until the cache is under the given size.
1699
+
-`--max-download-size=SIZE`--- Deletes the oldest downloaded cache data until the cache is under the given size.
1700
+
1701
+
ADURATION is specified in the form "N seconds/minutes/days/weeks/months" where N is an integer.
1702
+
1703
+
ASIZE is specified in the form "N *suffix*" where *suffix* is B, kB, MB, GB, kiB, MiB, or GiB, and N is an integer or floating point number. If no suffix is specified, the number is the number of bytes.
0 commit comments