Skip to content

expiration not update #51

@RelicOfTesla

Description

@RelicOfTesla
		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 {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions