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

feat(GCS): Update CustomTime metadata field at cache entry hits #2337

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

whisperity
Copy link

Resolves #2318.

This commit introduces the architectural support for implementing a cache-provider-specific routine that updates an atime-like (access time) timestamp every time a cache entry is successfully hit. Several cloud providers implement such semantics under different names and APIs, most commonly for the purpose of providing a better time-out and culling mechanism. The logic in sccache only performs the bookkeeping of this information. With this feature, it is possible to give the necessary inputs to the cloud provider's lifecycle routines to allow keeping cloud costs and size low by culling cache objects that had not been hit for a set amount of time.

Added the support for the aforementioned logic specifically for the GCS cache implementation, where the custom access time medata is available under the CustomTime attribute, which can be bumped only ever forward in time. In case a bumping is unsuccessful (due to clocks getting out-of-synch), the error is silently discarded.

Screenshot of the Google Cloud Console inspecting the metadata of a cache object where Custom Time is set.

This commit introduces the architectural support for implementing a
cache-provider-specific routine that updates an `atime`-like (access
time) timestamp every time a cache entry is successfully hit. Several
cloud providers implement such semantics under different names and APIs,
most commonly for the purpose of providing a better time-out and culling
mechanism. The logic in _sccache_ only performs the bookkeeping of this
information. With this feature, it is possible to give the necessary
inputs to the cloud provider's lifecycle routines to allow keeping cloud
costs and size low by culling cache objects that had not been hit for a
set amount of time.

Added the support for the aforementioned logic specifically for the GCS
cache implementation, where the custom access time medata is available
under the `CustomTime` attribute, which can be bumped only ever forward
in time. In case a bumping is unsuccessful (due to clocks getting
out-of-synch), the error is silently discarded.
@sylvestre sylvestre requested a review from Xuanwo February 19, 2025 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant