diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-06-12 11:07:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-12 11:07:26 +0100 |
commit | 079d8fe8fb521f76fee3bff5b47482d5fb911257 (patch) | |
tree | 964aacf3bdf2182a61eac14cd0e5e8e75187f7b7 /internal/caching/impl_inmemorylru.go | |
parent | ec7718e7f842fa0fc5198489c904de21003db4c2 (diff) |
More key tweaks (#1116)
Diffstat (limited to 'internal/caching/impl_inmemorylru.go')
-rw-r--r-- | internal/caching/impl_inmemorylru.go | 7 |
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) } |