Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RWMutexMap ¶
type RWMutexMap[T any] struct { // contains filtered or unexported fields }
RWMutexMap is a concurrency-safe map, using a sync.RWMutex to lock a backing map when accessing values.
func (*RWMutexMap[T]) Del ¶
func (m *RWMutexMap[T]) Del(k string)
Del sets a read-write lock on the map and deletes the value for k from it.
func (*RWMutexMap[T]) Get ¶
func (m *RWMutexMap[T]) Get(k string) (T, bool)
Get sets a read lock on the map, retrieving the value for k. A second return value indicates whether the key was present in the map.
func (*RWMutexMap[T]) Set ¶
func (m *RWMutexMap[T]) Set(k string, t T)
Set locks the map, setting the key k to the value t.
func (*RWMutexMap[T]) Visit ¶
func (m *RWMutexMap[T]) Visit(f func(k string, v T))
Visit read-locks the map and calls the function f for each member.
Click to show internal directories.
Click to hide internal directories.