Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cache): Add "tidy" as older cache removal command #6229

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

flodavid
Copy link

  • Keep two items in cache for every app
  • Files that are less than one month old are not deleted
  • Automatically remove older cache of the app after an update
  • Short option to do not use cache changed form -k to -d (for "download")
  • Add option to keep older cache, with -k (for "keep") as short option to update command
  • Add long option --keep-cache to update command

Description

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 with scoop 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:

  • I have read the Contributing Guide.
  • I have ensured that I am targeting the develop branch.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.
  • I have added an entry in the CHANGELOG.

@flodavid flodavid force-pushed the feature/remove-old-cache branch 3 times, most recently from 48199e7 to a130d6b Compare November 15, 2024 09:37
- Keep two items in cache for every app
- Files that are less than one month old are not deleted
- Automatically remove older cache of the app after an update
- Short option to do not use cache changed form `-k` to `-d`
(for "download")
- Add option to keep older cache, with `-k` (for "keep")
as short option to `update` command
- Add long option `--keep-cache` to `update` command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant