Skip to content

Commit 12dcc16

Browse files
authored
common/lru: use clear builtin (#29399)
1 parent ab6419c commit 12dcc16

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

common/lru/basiclru.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,7 @@ func (c *BasicLRU[K, V]) Peek(key K) (value V, ok bool) {
115115
// Purge empties the cache.
116116
func (c *BasicLRU[K, V]) Purge() {
117117
c.list.init()
118-
for k := range c.items {
119-
delete(c.items, k)
120-
}
118+
clear(c.items)
121119
}
122120

123121
// Remove drops an item from the cache. Returns true if the key was present in cache.

0 commit comments

Comments
 (0)