MCPcopy
hub / github.com/go-gorm/gorm / RemoveOldest

Method RemoveOldest

internal/lru/lru.go:200–208  ·  view source on GitHub ↗

RemoveOldest removes the oldest item from the cache.

()

Source from the content-addressed store, hash-verified

198
199// RemoveOldest removes the oldest item from the cache.
200func (c *LRU[K, V]) RemoveOldest() (key K, value V, ok bool) {
201 c.mu.Lock()
202 defer c.mu.Unlock()
203 if ent := c.evictList.Back(); ent != nil {
204 c.removeElement(ent)
205 return ent.Key, ent.Value, true
206 }
207 return
208}
209
210// GetOldest returns the oldest entry
211func (c *LRU[K, V]) GetOldest() (key K, value V, ok bool) {

Callers 1

TestLRURemoveOldestFunction · 0.80

Calls 2

removeElementMethod · 0.95
BackMethod · 0.80

Tested by 1

TestLRURemoveOldestFunction · 0.64