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:
parent
bd2fbee48c
commit
31f7040e05
2 changed files with 21 additions and 12 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue