Skip to content

What does restore-keys do? #578

Answered by domjtalbot
nchammas asked this question in Q&A

You must be logged in to vote

Hey @nchammas!

The restore-keys option works as a backup for when the specific cache key you want doesn't return any results.

For instance a minimal setup could look like this:

- uses: actions/cache@v2
   with:
     path: ~/.cache/pip
     key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}

In this example, we're requesting that ~/.cache/pip is cached using the key provided which could look like Linux-pip-8156c. However, the cache will only be restored if the key is a perfect match. This might be exactly what you want it to do, but you might also want it to restore another cache as a backup, which is where restore-keys comes into play!

- uses: actions/cache@v2
   with:
     p…

Replies: 1 comment 2 replies

You must be logged in to vote
2 replies
@nchammas

@domjtalbot

Answer selected by nchammas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants