diff --git a/common/lru/blob_lru.go b/common/lru/blob_lru.go index c9b3398503..eecfea8db3 100644 --- a/common/lru/blob_lru.go +++ b/common/lru/blob_lru.go @@ -82,3 +82,21 @@ 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() + + 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 +}