dnfjson: use new size-based cache management

- Update timestamps for cache elements whenever a repository is used.
- Call the new `shrink()` function instead of the old `clean()`.
- Remove the old `clean()` function.
This commit is contained in:
Achilleas Koutsou 2022-06-07 13:38:03 +02:00 committed by Tom Gundersen
parent bd2fbee48c
commit 31f7040e05
2 changed files with 21 additions and 12 deletions

View file

@ -48,17 +48,6 @@ func newRPMCache(path string, maxSize uint64) *rpmCache {
return r
}
func (r *rpmCache) clean() error {
curSize, err := dirSize(r.root)
if err != nil {
return err
}
if curSize > r.maxSize {
return os.RemoveAll(r.root)
}
return nil
}
// updateInfo updates the repoPaths and repoRecency fields of the rpmCache.
func (r *rpmCache) updateInfo() {
cacheEntries, _ := os.ReadDir(r.root)