Provide a mechanism to have a per file cache eviction/retention
@tiwarishub is already working on this.
Since May 7, 2022.
- Dominant language
- TypeScript
- Stars
- 5.6k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
This is related to issue https://github.com/actions/setup-java/issues/269
The problem is that caches fill up over time as dependencies, runtimes, and tooling are upgraded. Old files are never evicted and the cache grows. The current solution is to recalculate the cache-key at every build (base it on the week number or such) and throw it all away, but that works against the purpose of a cache to begin with.
I suggest that when saving the caches we should be able to evict files older than a configurable number of days. That way old dependencies will be removed over time and we can have the best of both worlds.
PS. I'm not sure how the cache-hit logic works in this scenario.
Something like this:
- name: Configure Gradle JDK cache
uses: actions/cache@v3
with:
path: ~/.gradle/jdks
key: gradle-jdks-${{ runner.os }}
# Evict files older than 30 days from the cache and repackage.
eviction:
include: # required, we don't want to remove just any file and corrupt the cache
- **/*.zip
- **/*.jar
- **/*.tar
days: 30
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.