- Sort Score
- Num 10 results
- Language All
Results 1 - 2 of 2 for GetOldest (0.06 seconds)
-
internal/lru/lru.go
c.mu.Lock() defer c.mu.Unlock() if ent := c.evictList.Back(); ent != nil { c.removeElement(ent) return ent.Key, ent.Value, true } return } // GetOldest returns the oldest entry func (c *LRU[K, V]) GetOldest() (key K, value V, ok bool) { c.mu.RLock() defer c.mu.RUnlock() if ent := c.evictList.Back(); ent != nil { return ent.Key, ent.Value, true } return }
Created: Sun Apr 05 09:35:12 GMT 2026 - Last Modified: Sat Mar 21 11:35:55 GMT 2026 - 12.6K bytes - Click Count (0) -
tests/lru_test.go
// } func TestLRUWithPurge(t *testing.T) { var evicted []string lc := lru.NewLRU(10, func(key string, value string) { evicted = append(evicted, key, value) }, 150*time.Millisecond) k, v, ok := lc.GetOldest() if k != "" { t.Fatalf("should be empty") } if v != "" { t.Fatalf("should be empty") } if ok { t.Fatalf("should be false") } lc.Add("key1", "val1")
Created: Sun Apr 05 09:35:12 GMT 2026 - Last Modified: Mon Sep 08 09:19:22 GMT 2025 - 10.4K bytes - Click Count (0)