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

Method removeOldest

internal/lru/lru.go:306–310  ·  view source on GitHub ↗

Close destroys cleanup goroutine. To clean up the cache, run Purge() before Close(). func (c *LRU[K, V]) Close() { c.mu.Lock() defer c.mu.Unlock() select { case <-c.done: return default: } close(c.done) } removeOldest removes the oldest item from the cache. Has to be called with lock!

()

Source from the content-addressed store, hash-verified

304
305// removeOldest removes the oldest item from the cache. Has to be called with lock!
306func (c *LRU[K, V]) removeOldest() {
307 if ent := c.evictList.Back(); ent != nil {
308 c.removeElement(ent)
309 }
310}
311
312// removeElement is used to remove a given list element from the cache. Has to be called with lock!
313func (c *LRU[K, V]) removeElement(e *Entry[K, V]) {

Callers 2

AddMethod · 0.95
ResizeMethod · 0.95

Calls 2

removeElementMethod · 0.95
BackMethod · 0.80

Tested by

no test coverage detected