MCPcopy
hub / github.com/perkeep/perkeep / RemoveOldest

Method RemoveOldest

internal/lru/cache.go:99–105  ·  view source on GitHub ↗

RemoveOldest removes the oldest item in the cache and returns its key and value. If the cache is empty, the empty string and nil are returned.

()

Source from the content-addressed store, hash-verified

97// RemoveOldest removes the oldest item in the cache and returns its key and value.
98// If the cache is empty, the empty string and nil are returned.
99func (c *Cache) RemoveOldest() (key string, value interface{}) {
100 if !c.nolock {
101 c.mu.Lock()
102 defer c.mu.Unlock()
103 }
104 return c.removeOldest()
105}
106
107// note: must hold c.mu
108func (c *Cache) removeOldest() (key string, value interface{}) {

Callers 3

ReceiveBlobMethod · 0.80
removeOldestMethod · 0.80
TestRemoveOldestFunction · 0.80

Calls 3

removeOldestMethod · 0.95
LockMethod · 0.80
UnlockMethod · 0.80

Tested by 1

TestRemoveOldestFunction · 0.64