-
-
Notifications
You must be signed in to change notification settings - Fork 41
Closed
Description
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 {
Code-Hex
Metadata
Metadata
Assignees
Labels
No labels