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

move cache TTLs to a struct #2

Merged
merged 6 commits into from
Jan 6, 2022
Merged

Conversation

akanshat
Copy link

Signed-off-by: akanshat [email protected]

  • [] CHANGELOG entry if change is relevant to the end user.

Changes

  • Moved CachingWithBackendConfig into a new package cacheconfig.

Verification

  • Existing tests passed.

Copy link
Owner

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this solves half of the problem. There are two parts to it:

  • We should only have one struct with all of the TTL information. You have done this here 🤗
  • 2nd part is about associating those TTLs with the respective functions such as cacheconfig.IsBlocksRootDir and so on.

But, I think that this is going in the wrong direction.

The 1st/2nd part is already kind of done but we are only doing it in CachingBucketConfig; the new groupcache Getter function reimplements the same matching, right? Perhaps CachingBucketConfig could accept a nil cache.Cache and expose those functions like findGetConfig and so on. Then we could use them inside the getter function. What do you think?

Copy link
Owner

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 💪 just some suggestions

pkg/cache/groupcache.go Show resolved Hide resolved
pkg/store/cache/caching_bucket_factory.go Outdated Show resolved Hide resolved
pkg/cache/groupcache.go Outdated Show resolved Hide resolved
Signed-off-by: akanshat <[email protected]>
@akanshat akanshat marked this pull request as ready for review January 3, 2022 07:59
@akanshat akanshat requested a review from GiedriusS January 4, 2022 20:45
Copy link
Owner

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, modulo minor nits 👍 thank you for this amazing work

@GiedriusS GiedriusS merged commit d0ef6f2 into GiedriusS:add_ttl Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants