From f948dc8c188ad09631c7f45bc0475c084eb63a62 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 14 Jun 2022 10:02:50 +0100 Subject: [PATCH] Tweak --- internal/caching/impl_ristretto.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/caching/impl_ristretto.go b/internal/caching/impl_ristretto.go index 4748d33b1..85337e4ba 100644 --- a/internal/caching/impl_ristretto.go +++ b/internal/caching/impl_ristretto.go @@ -132,10 +132,8 @@ func NewRistrettoCachePartition(name string, mutable bool, maxEntries int, maxAg func (c *RistrettoCachePartition) Set(key string, value interface{}) { if !c.mutable { - if peek, ok := c.ristretto.Get(key); ok { - if entry, ok := peek.(*inMemoryLRUCacheEntry); ok && entry.value != value { - panic(fmt.Sprintf("invalid use of immutable cache tries to mutate existing value of %q", key)) - } + if entry, ok := c.ristretto.Get(key); ok && entry != value { + panic(fmt.Sprintf("invalid use of immutable cache tries to mutate existing value of %q", key)) } } c.ristretto.SetWithTTL(key, value, 1, c.maxAge)