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())