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

Option to configure Tag Key TLL in Redis #275

Open
gurleensethi-docker opened this issue Feb 19, 2025 · 0 comments
Open

Option to configure Tag Key TLL in Redis #275

gurleensethi-docker opened this issue Feb 19, 2025 · 0 comments

Comments

@gurleensethi-docker
Copy link

Issue: Configurable TTL for Redis Tag Keys

Problem
The TTL (Time to Live) for Redis tag keys is currently hardcoded to 720*time.Hour (30 days). This results in excessive memory consumption in Redis instances, as tags persist far longer than the associated cached values (which have significantly shorter TTLs).

Current Implementation
The TTL is set to 30 days in the setTags function:

func (s *RedisStore) setTags(ctx context.Context, key any, tags []string) {
	for _, tag := range tags {
		tagKey := fmt.Sprintf(RedisTagPattern, tag)
		s.client.SAdd(ctx, tagKey, key.(string))
		s.client.Expire(ctx, tagKey, 720*time.Hour) // Hardcoded TTL
	}
}

Link to code

Request
Add the ability to configure the TTL duration for Redis tag keys instead of using a hardcoded value.

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

No branches or pull requests

1 participant