Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshvanahalli committed Nov 12, 2024
1 parent ecbb71b commit 68cb86d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion common/lru/blob_lru.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,16 @@ func (c *SizeConstrainedCache[K, V]) Remove(key K) {
c.lock.Lock()
defer c.lock.Unlock()

c.lru.Remove(key)
if v, ok := c.lru.Peek(key); ok {
c.size -= uint64(len(v))
c.lru.Remove(key)
}
}

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

c.lru.Purge()
c.size = 0
}

0 comments on commit 68cb86d

Please sign in to comment.