Remove cache purge methods to clean (#1159)

This is more consistent with the public interface.
This commit is contained in:
Charlie Marsh 2024-01-28 18:15:11 -08:00 committed by GitHub
parent d88ce76979
commit fa3f0d7a55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View file

@ -246,7 +246,7 @@ impl Cache {
/// Remove a package from the cache.
///
/// Returns the number of entries removed from the cache.
pub fn purge(&self, name: &PackageName) -> Result<usize, io::Error> {
pub fn clean(&self, name: &PackageName) -> Result<usize, io::Error> {
let mut count = 0;
for bucket in [
CacheBucket::Wheels,
@ -255,7 +255,7 @@ impl Cache {
CacheBucket::Interpreter,
CacheBucket::Simple,
] {
count += bucket.purge(self, name)?;
count += bucket.clean(self, name)?;
}
Ok(count)
}
@ -508,10 +508,10 @@ impl CacheBucket {
}
}
/// Purge a package from the cache bucket.
/// Remove a package from the cache bucket.
///
/// Returns the number of entries removed from the cache.
fn purge(self, cache: &Cache, name: &PackageName) -> Result<usize, io::Error> {
fn clean(self, cache: &Cache, name: &PackageName) -> Result<usize, io::Error> {
fn remove(path: impl AsRef<Path>) -> Result<bool, io::Error> {
Ok(if force_remove_all(path.as_ref())? {
debug!("Removed cache entry: {}", path.as_ref().display());

View file

@ -40,7 +40,7 @@ pub(crate) fn clean(
})?;
} else {
for package in packages {
let count = cache.purge(package)?;
let count = cache.clean(package)?;
match count {
0 => writeln!(printer, "No entries found for package: {}", package.cyan())?,
1 => writeln!(printer, "Cleared 1 entry for package: {}", package.cyan())?,