Feature request: option to update cache
See original GitHub issueProblem Description Currently, the cache action either restores an existing cache on cache-hit, or generates a missing cache on cache-miss. It does not update the cache on cache-hit.
This works well for caching static dependencies, but not for caching build artefacts.
Proposed Solution
Add an option allowing the user to enable cache updates.
This should be false
by default to retain backwards-compatibility.
uses: actions/cache@v2
with:
path: ccache
key: ${{ matrix.CONFIG }}-${{ matrix.CXX }}-${{ matrix.TYPE }}
update: true # <~~ explicitly request an update
Motivation Some programming languages benefit greatly from build caching. C++ in conjunction with ccache is the prime example. Using caching commonly decreases compilation times by at least 70%. Medium-sized projects easily take 20 minutes to compile. ccache also manages the cache size itself and automatically removes obsolete entries, thus the cache won’t explode with continuous updates.
It also saves time and money for both user and provider. The environment will be happy too.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:130
- Comments:15
Top GitHub Comments
Maybe save as
ccache-${{ github.run_id }}
and restore with restore keyccache-
. github.run_id is unique id for the workflow run, so every time a new cache is saved. When restoring you will never have an exact match but then theccache-
restore key will restore the latest one that started with that string and in the end create a new one with the current state.Nah, that’s merely a work-around. It will fill up your 5 GiB of cache and then evict things that might not have been evicted if the cache would have been updatable.