feat(cache): Add "tidy" as older cache removal command #6229
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
-k
to-d
(for "download")-k
(for "keep") as short option toupdate
command--keep-cache
toupdate
commandDescription
The new
cache tidy
command enables to clean all packages older than one month, except the two most recent ones, of all the apps (with "*"), or a given one. This cache "tidying" is automatically ran after an app is updated, for this app only.No option to change the one month period or the minimum number to keep is present at the moment.
Motivation and Context
Files in the cache folder were never automatically removed. It makes it grow in size and many (most?) do not know about it or or how to clean it. Besides, the only way to manage the cache was by removing all of it.
Closes #6068
How Has This Been Tested?
I have overwritten my local scoop scripts with the ones I modified in the repository.
I modified the date of a copy of a recent "which" package in cache with
(Get-Item which#2.16#607562b.zip).lastwritetime=$(Get-Date -Year 2020 -Month 12 -Day 31)
. Then I used the new tidy command withscoop tidy which
. Only the package that is supposed to be older was removed.Then I modified the version in the manifest of the "current" package of which, so that scoop suppose it is outdated. I did the same procedure of copying a recent package and editing its date. Then I ran
scoop update which
. "which" was reinstalled. Again, only the package that is supposed to be older was removed.Checklist:
develop
branch.