Documentation
¶
Index ¶
- type MutexMap
- func (m *MutexMap[K, _]) Delete(key K)
- func (m *MutexMap[K, V]) Load(key K) (V, bool)
- func (m *MutexMap[K, V]) LoadAndDelete(key K) (V, bool)
- func (m *MutexMap[K, V]) LoadOrStore(key K, val V) (V, bool)
- func (m *MutexMap[K, V]) Range(f func(key K, value V) bool)
- func (m *MutexMap[K, V]) Store(key K, val V)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MutexMap ¶
type MutexMap[K comparable, V any] struct { sync.RWMutex // contains filtered or unexported fields }
MutexMap provides a go standard map protected by a RWMutex. It exposes the same methods as sync.Map but with better type safety and performance in scenarios with up to four cores. Type parameter K for the map's key and type parameter V for the map's values. For benchmarks compare: https://medium.com/@deckarep/the-new-kid-in-town-gos-sync-map-de24a6bf7c2c
func NewMutexMap ¶
func NewMutexMap[K comparable, V any]() *MutexMap[K, V]
func (*MutexMap[K, V]) LoadAndDelete ¶
func (*MutexMap[K, V]) LoadOrStore ¶
Click to show internal directories.
Click to hide internal directories.