Documentation ¶
Index ¶
- type MapSync
- func (t *MapSync[K, V]) Clear()
- func (t *MapSync[K, V]) Clone(key K) map[K]V
- func (t *MapSync[K, V]) Contains(key K) bool
- func (t *MapSync[K, V]) Empty() bool
- func (t *MapSync[K, V]) Get(key K) (V, bool)
- func (t *MapSync[K, V]) GetOrSet(key K, value V) (V, bool)
- func (t *MapSync[K, V]) GetOrSetFunc(key K, fn func() V) (V, bool)
- func (t *MapSync[K, V]) Insert(key K, value V)
- func (t *MapSync[K, V]) Iterator(visitor visitor.KvVisitor[K, V])
- func (t *MapSync[K, V]) Keys() []K
- func (t *MapSync[K, V]) LockFunc(fn func(m map[K]V))
- func (t *MapSync[K, V]) Remove(key K) (V, bool)
- func (t *MapSync[K, V]) Set(key K, value V) V
- func (t *MapSync[K, V]) SetIfNotExist(key K, value V) bool
- func (t *MapSync[K, V]) Size() int
- func (t *MapSync[K, V]) String() string
- func (t *MapSync[K, V]) Values() []V
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MapSync ¶
type MapSync[K comparable, V any] struct { Map map[K]V Lock sync.Locker }
gosync "sync"
func (*MapSync[K, V]) Get ¶
Find finds the first node that the key is equal to the passed key, and returns its value
func (*MapSync[K, V]) GetOrSetFunc ¶ added in v1.3.7
func (*MapSync[K, V]) Insert ¶
func (t *MapSync[K, V]) Insert(key K, value V)
Insert inserts a key-value pair into the RbTree.
func (*MapSync[K, V]) LockFunc ¶ added in v1.3.5
func (t *MapSync[K, V]) LockFunc(fn func(m map[K]V))
func (*MapSync[K, V]) SetIfNotExist ¶ added in v1.3.14
type Option ¶
type Option func(option *Options)
Option is a function type used to set Options
func WithGoroutineSafe ¶
func WithGoroutineSafe() Option
WithGoroutineSafe is used to set the set goroutine-safe Note that iterators are not goroutine safe, and it is useless to turn on the setting option here. so don't use iterators in multi goroutines
Click to show internal directories.
Click to hide internal directories.