mirror of https://github.com/astral-sh/uv
Remove cache `purge` methods to `clean` (#1159)
This is more consistent with the public interface.
This commit is contained in:
parent
d88ce76979
commit
fa3f0d7a55
|
|
@ -246,7 +246,7 @@ impl Cache {
|
||||||
/// Remove a package from the cache.
|
/// Remove a package from the cache.
|
||||||
///
|
///
|
||||||
/// Returns the number of entries removed 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;
|
let mut count = 0;
|
||||||
for bucket in [
|
for bucket in [
|
||||||
CacheBucket::Wheels,
|
CacheBucket::Wheels,
|
||||||
|
|
@ -255,7 +255,7 @@ impl Cache {
|
||||||
CacheBucket::Interpreter,
|
CacheBucket::Interpreter,
|
||||||
CacheBucket::Simple,
|
CacheBucket::Simple,
|
||||||
] {
|
] {
|
||||||
count += bucket.purge(self, name)?;
|
count += bucket.clean(self, name)?;
|
||||||
}
|
}
|
||||||
Ok(count)
|
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.
|
/// 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> {
|
fn remove(path: impl AsRef<Path>) -> Result<bool, io::Error> {
|
||||||
Ok(if force_remove_all(path.as_ref())? {
|
Ok(if force_remove_all(path.as_ref())? {
|
||||||
debug!("Removed cache entry: {}", path.as_ref().display());
|
debug!("Removed cache entry: {}", path.as_ref().display());
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ pub(crate) fn clean(
|
||||||
})?;
|
})?;
|
||||||
} else {
|
} else {
|
||||||
for package in packages {
|
for package in packages {
|
||||||
let count = cache.purge(package)?;
|
let count = cache.clean(package)?;
|
||||||
match count {
|
match count {
|
||||||
0 => writeln!(printer, "No entries found for package: {}", package.cyan())?,
|
0 => writeln!(printer, "No entries found for package: {}", package.cyan())?,
|
||||||
1 => writeln!(printer, "Cleared 1 entry for package: {}", package.cyan())?,
|
1 => writeln!(printer, "Cleared 1 entry for package: {}", package.cyan())?,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue