-
Notifications
You must be signed in to change notification settings - Fork 0
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
cache: add TTL support #1
cache: add TTL support #1
Conversation
pkg/cache/groupcache.go
Outdated
config, err := parseGroupcacheConfig(conf) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return NewGroupcacheWithConfig(logger, reg, config, basepath, r, bucket) | ||
return NewGroupcacheWithConfig(logger, reg, config, basepath, r, bucket, isTSDBChunkFile, isMetaFile, isBlocksRootDir, MetaFileExistsTTL, MetafileDoesntExistTTL, MetafileContentTTL, ChunkObjectAttrsTTL, ChunkSubrangeTTL, BlocksIterTTL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be cool if our struct had an interface like this to avoid passing so many parameters:
https://github.com/thanos-io/thanos/blob/main/pkg/store/cache/caching_bucket_factory.go#L109-L114
pkg/cache/groupcache.go
Outdated
if isBlocksRootDir(parsedData.Name) { | ||
return dest.UnmarshalBinary(encodedList, time.Now().Add(BlocksIterTTL)) | ||
} | ||
panic("caching bucket layer must not call on unconfigured paths") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was under the impression we should never use panic. Shouldn't we be returning an error instead of panicking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that using panic
s to check for logic bugs in code is one of the very few valid use cases for it 😄
@GiedriusS Can you please rebase and resolve the conflict? |
Adds TTL support to galaxycache as per this pull request: thanos-community/galaxycache#1 Signed-off-by: Giedrius Statkevičius <[email protected]>
@akanshat rebased 👼 hopefully we can work on improving the interface now! Then we could merge this ❤️ |
Signed-off-by: akanshat <[email protected]>
Signed-off-by: akanshat <[email protected]>
Signed-off-by: akanshat <[email protected]>
Signed-off-by: akanshat <[email protected]>
Signed-off-by: akanshat <[email protected]>
Signed-off-by: akanshat <[email protected]>
move cache TTLs to a struct
Let's merge this now as well? @akanshat |
Adds TTL support to galaxycache as per this pull request:
thanos-community/galaxycache#1
Signed-off-by: Giedrius Statkevičius [email protected]
With these changes: