From 079d8fe8fb521f76fee3bff5b47482d5fb911257 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 12 Jun 2020 11:07:26 +0100 Subject: More key tweaks (#1116) --- internal/caching/impl_inmemorylru.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'internal/caching/impl_inmemorylru.go') diff --git a/internal/caching/impl_inmemorylru.go b/internal/caching/impl_inmemorylru.go index f7901d2e..158deca4 100644 --- a/internal/caching/impl_inmemorylru.go +++ b/internal/caching/impl_inmemorylru.go @@ -68,6 +68,13 @@ func (c *InMemoryLRUCachePartition) Set(key string, value interface{}) { c.lru.Add(key, value) } +func (c *InMemoryLRUCachePartition) Unset(key string) { + if !c.mutable { + panic(fmt.Sprintf("invalid use of immutable cache tries to unset value of %q", key)) + } + c.lru.Remove(key) +} + func (c *InMemoryLRUCachePartition) Get(key string) (value interface{}, ok bool) { return c.lru.Get(key) } -- cgit v1.2.3