From c9f3539b5a9f9746f1629b51a64fb9adf8398cad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jul 2023 10:20:11 +0000 Subject: [chore]: Bump codeberg.org/gruf/go-cache/v3 from 3.4.1 to 3.4.3 (#2022) --- vendor/codeberg.org/gruf/go-cache/v3/result/cache.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'vendor/codeberg.org/gruf/go-cache') diff --git a/vendor/codeberg.org/gruf/go-cache/v3/result/cache.go b/vendor/codeberg.org/gruf/go-cache/v3/result/cache.go index 74644b073..a86a72c77 100644 --- a/vendor/codeberg.org/gruf/go-cache/v3/result/cache.go +++ b/vendor/codeberg.org/gruf/go-cache/v3/result/cache.go @@ -228,11 +228,15 @@ func (c *Cache[Value]) Load(lookup string, load func() (Value, error), keyParts var evict func() - // Acquire cache lock. + // Lock cache. c.cache.Lock() + defer func() { + // Unlock cache. c.cache.Unlock() + if evict != nil { + // Call evict. evict() } }() @@ -266,21 +270,25 @@ func (c *Cache[Value]) Store(value Value, store func() error) error { var evict func() - // Acquire cache lock. + // Lock cache. c.cache.Lock() + defer func() { + // Unlock cache. c.cache.Unlock() + if evict != nil { + // Call evict. evict() } + + // Call invalidate. + c.invalid(value) }() // Store result in cache. evict = c.store(result) - // Call invalidate. - c.invalid(value) - return nil } -- cgit v1.2.3