Skip to content

Commit

Permalink
Add Clear method to SizeConstrainedCache
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshvanahalli committed Nov 7, 2024
1 parent 575062f commit ecbb71b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions common/lru/blob_lru.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,17 @@ func (c *SizeConstrainedCache[K, V]) Get(key K) (V, bool) {

return c.lru.Get(key)
}

func (c *SizeConstrainedCache[K, V]) Remove(key K) {
c.lock.Lock()
defer c.lock.Unlock()

c.lru.Remove(key)
}

func (c *SizeConstrainedCache[K, V]) Clear() {
c.lock.Lock()
defer c.lock.Unlock()

c.lru.Purge()
}

0 comments on commit ecbb71b

Please sign in to comment.