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

Set index cache ttl based on block meta #8089

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SungJin1212
Copy link
Contributor

@SungJin1212 SungJin1212 commented Feb 4, 2025

This PR exposes TTL to the index cache to set cache TTL differently based on block metadata. We can use a short TTL for temporary blocks that will be compacted soon and a long TTL for large blocks that won't be compacted.

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Expose TTL for store functions of the index cache to set cache TTL differently based on block metadata.

Verification

@SungJin1212 SungJin1212 marked this pull request as draft February 4, 2025 11:40
@SungJin1212 SungJin1212 force-pushed the Set-index-cache-ttl-based-on-block-meta branch from 7811a90 to d57f685 Compare February 4, 2025 11:42
// CacheTTL returns cache TTL based on the block meta. A Short TTL is useful for
// temporary blocks that will be compacted soon and a long TTL for large blocks
// that won't be compacted.
func CacheTTL(meta *metadata.Meta) time.Duration {
Copy link
Contributor

Choose a reason for hiding this comment

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

For my usecase, I would like to take cache item type into consideration. I want to cache expanded postings with a larger TTL and postings for smaller TTL. Do we have a good way to make this customizable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants