mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 02:48:17 +00:00
Remove cache purge
methods to clean
(#1159)
This is more consistent with the public interface.
This commit is contained in:
parent
d88ce76979
commit
fa3f0d7a55
2 changed files with 5 additions and 5 deletions
|
@ -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());
|
||||
|
|
|
@ -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())?,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue