From 2ee81adbdbcfd2b3de79695ca1726ae84a5b6d59 Mon Sep 17 00:00:00 2001 From: mazrean Date: Sun, 8 Dec 2024 13:45:02 +0900 Subject: [PATCH] fix --- cache/sc.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cache/sc.go b/cache/sc.go index 8e49c8b..8c4d23b 100644 --- a/cache/sc.go +++ b/cache/sc.go @@ -411,7 +411,8 @@ func (m *AtomicMap[K, V, T]) Update(key K, f func(V) (V, bool)) { defer m.locker.Unlock() av, ok := m.m[key] if !ok { - return + av = &atomic.Pointer[T]{} + m.m[key] = av } v, ok := f(av.Load())