mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
Remove refresh checks from the install plan (#1119)
## Summary Rather than checking cache freshness in the install plan, it's a lot simple to have the install plan _never_ return cached data when the refresh policy is in place, and then rely on the distribution database to check for freshness. The original implementation didn't support this, since the distribution database was rebuilding things too often. Now, it rarely rebuilds (it's much better about this), so it seems conceptually much simpler to split up the responsibilities like this.
This commit is contained in:
parent
50057cd5f2
commit
f593b65447
4 changed files with 57 additions and 93 deletions
|
@ -160,6 +160,15 @@ impl Cache {
|
|||
CacheEntry::new(self.bucket(cache_bucket).join(dir), file)
|
||||
}
|
||||
|
||||
/// Returns `true` if a cache entry must be revalidated given the [`Refresh`] policy.
|
||||
pub fn must_revalidate(&self, package: &PackageName) -> bool {
|
||||
match &self.refresh {
|
||||
Refresh::None => false,
|
||||
Refresh::All(_) => true,
|
||||
Refresh::Packages(packages, _) => packages.contains(package),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns `true` if a cache entry is up-to-date given the [`Refresh`] policy.
|
||||
pub fn freshness(
|
||||
&self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue