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

Basic cache eviction #54

Merged
merged 1 commit into from
Apr 14, 2024
Merged

Basic cache eviction #54

merged 1 commit into from
Apr 14, 2024

Conversation

ericcornelissen
Copy link
Collaborator

@ericcornelissen ericcornelissen commented Apr 13, 2024

Closes #3

Verify

Add a simple and basic cache eviction strategy in order to avoid growing the cache indefinitely and to avoid validating against cache entries indefinitely (which may lead to false negatives). The current eviction strategy is to remove anything older than 5 days.

Cache eviction happens in three scenarios. It happens when updating or verifying (unless the -no-evict flag is used), or explicitly using ghasum cache evict.

This implementation slightly extends the stated use case in #3 ("keeping the cache at a reasonable size"). The implementation here also considers the scenario where a cached entry prevents proper validation because the remote has been updated.

Add a simple and basic cache eviction strategy in order to avoid growing
the cache indefinitely and to avoid validating against cache entries
indefinitely (which may lead to false negatives). The current eviction
strategy is to remove anything older than 5 days.

Cache eviction happens in three scenarios. It happens when updating or
verifying (unless the `-no-evict` flag is used, more on that below), or
when explicitly using `ghasum cache evict`.

Eviction is done at the repository level. That is, a cached repository
will be evicted if it was cloned more than 5 days ago. Note that repos
are cloned and stored on a per version basis, so the eviction should
happen on, e.g., `actions/checkout/v5.0.0` (and not `actions/checkout`).

Cache eviction can be disabled when updating or verifying to support use
cases where eviction isn't desired. One example is when there is no
internet connection. Another example is when validating in a CI pipeline
(because we really want to validate with the runner put there, even if
its timestamp indicates it's old).
@ericcornelissen ericcornelissen added the enhancement New feature or request label Apr 13, 2024
@ericcornelissen ericcornelissen merged commit 0183d02 into main Apr 14, 2024
11 checks passed
@ericcornelissen ericcornelissen deleted the 3-cache-eviction branch April 14, 2024 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatic cache management
1 participant