feat: add an option to allow using a time based rolling cache#73
Merged
bahmutov merged 2 commits intoJan 31, 2021
Merged
Conversation
Owner
|
Makes sense, let me first merge this PR into a local branch to see how it changes all examples. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This action currently has a pretty conservative approach to caching in order to avoid ever-growing cache sizes that end up being slower than no cache at all. I think that makes sense as a default, but for projects with a lot of dependencies, a cache miss can be really painful. This PR adds a new option for a middle ground that uses more
restoreKeysthat are less specific like Github recommends in their docs, but periodically expires the cache which puts an upper bound on how long a cache can snowball for. I picked 1 month for the upper bound.This periodic expiry is accomplished by adding the current year and month of the run to the cache key, so runs will first use a cache exactly for the current lockfile hash, and then only use a cache from the most recent month. There's no global cache that it falls back to in order to avoid unbounded cache size growth. That means the first run of the month will always rebuild the cache from scratch, but I think that's fine to have one slow build a month instead of one slow build every time you change any dependencies.
Thanks for your feedback!