aboutsummaryrefslogtreecommitdiff
path: root/internal/caching/impl_inmemorylru.go
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-06-12 11:07:26 +0100
committerGitHub <noreply@github.com>2020-06-12 11:07:26 +0100
commit079d8fe8fb521f76fee3bff5b47482d5fb911257 (patch)
tree964aacf3bdf2182a61eac14cd0e5e8e75187f7b7 /internal/caching/impl_inmemorylru.go
parentec7718e7f842fa0fc5198489c904de21003db4c2 (diff)
More key tweaks (#1116)
Diffstat (limited to 'internal/caching/impl_inmemorylru.go')
-rw-r--r--internal/caching/impl_inmemorylru.go7
1 files changed, 7 insertions, 0 deletions
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)
}