Skip to main content

prune_cache

Function prune_cache 

Source
pub fn prune_cache(
    home: &Path,
    cache: &Path,
    limit_bytes: u64,
) -> Result<Option<Prune>>
Expand description

Delete files from the shared build cache until it fits its cap — but only while nobody live is registered as using it. crate::cache::maintenance_prune takes out the same lease a build would, so a prune can never race a compile in flight (this run’s own, another run’s, or a human’s magi review) into deleting a file that build still needs. Ok(None) when the cache is in use right now; the next pass catches it once the borrower releases it, the same way a cap of 0 or a missing CARGO_TARGET_DIR already meant “nothing to do this time” here.