From 12dcc162d05e87b6492c065458f2d7310b3cf791 Mon Sep 17 00:00:00 2001 From: cui <523516579@qq.com> Date: Tue, 2 Apr 2024 21:45:25 +0800 Subject: [PATCH] common/lru: use clear builtin (#29399) --- common/lru/basiclru.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/lru/basiclru.go b/common/lru/basiclru.go index c60f597066..7386c77840 100644 --- a/common/lru/basiclru.go +++ b/common/lru/basiclru.go @@ -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.