common/lru: use clear builtin (#29399)

This commit is contained in:
cui 2024-04-02 21:45:25 +08:00 committed by Daniel Liu
parent bc121d3634
commit 96e2743508

View file

@ -115,9 +115,7 @@ func (c *BasicLRU[K, V]) Peek(key K) (value V, ok bool) {
// Purge empties the cache.
func (c *BasicLRU[K, V]) Purge() {
c.list.init()
for k := range c.items {
delete(c.items, k)
}
clear(c.items)
}
// Remove drops an item from the cache. Returns true if the key was present in cache.