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

expiration not update #51

Closed
RelicOfTesla opened this issue Apr 14, 2024 · 0 comments · Fixed by #52
Closed

expiration not update #51

RelicOfTesla opened this issue Apr 14, 2024 · 0 comments · Fixed by #52

Comments

@RelicOfTesla
Copy link

RelicOfTesla commented Apr 14, 2024

		c.Set("1", 10, WithExpiration(10*time.Minute))  // queue index 0
		c.Set("2", 20, WithExpiration(20*time.Minute))  // queue index 1
		c.Set("1", 11, WithExpiration(100*time.Minute)) // must queue index 0 move to 1, check point
		nowFunc = func() time.Time {
			return now.Add(30 * time.Minute).Add(time.Minute)
		}
		maxItems = c.Len()
		c.DeleteExpired()
		got3 := c.Len()
		want3 := maxItems - 1
		if want3 != got3 {
			t.Errorf("want3 %d items but got3 %d", want3, got3)
		}
func (m *expirationManager[K]) update(key K, expiration time.Time) {
	if e, ok := m.mapping[key]; ok {
		e.expiration = expiration
		heap.Fix(&m.queue, e.index)
	} else {
@RelicOfTesla RelicOfTesla changed the title queue expiration not update expiration not update Apr 14, 2024
Code-Hex added a commit that referenced this issue Apr 14, 2024
Code-Hex added a commit that referenced this issue Apr 14, 2024
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 a pull request may close this issue.

1 participant