From 2e2d40b7ba0e9a054fcaf4ed735a1f8d70191842 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 1 Mar 2022 15:32:19 +0000 Subject: [PATCH] Evict cache entry if it's found to be stale when we call Get --- internal/caching/impl_inmemorylru.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/caching/impl_inmemorylru.go b/internal/caching/impl_inmemorylru.go index df6d87e56..997086b24 100644 --- a/internal/caching/impl_inmemorylru.go +++ b/internal/caching/impl_inmemorylru.go @@ -153,6 +153,7 @@ func (c *InMemoryLRUCachePartition) Get(key string) (value interface{}, ok bool) return nil, false } if c.maxAge > 0 && time.Since(entry.created) > c.maxAge { + c.lru.Remove(key) return nil, false } return entry.value, true