Skip to main content

clear_cache

Function clear_cache 

Source
pub fn clear_cache<L: RepoLayout>(layout: &L) -> Result<CacheUsage, EngineError>
Expand description

Delete the regenerable cache, returning what was removed.

It removes plan::cache_dir and nothing else. Reviews live in a sibling tree, so findings are out of reach by construction rather than by this function being careful — see the note on plan::cache_dir.

An absent directory is success with an empty result: clearing a cache that is already clear is not an error.

The count is taken before the delete, so a grouped run writing an entry in between would have that entry removed without being counted. Deliberately unlocked: the window is one syscall wide, the consequence is a report short by one on a machine running two of its own commands at once, and a lock would be a durable cost for a transient cosmetic one.