Documentation ¶
Index ¶
- Constants
- type Hashable
- type Map
- func (m *Map[K, V]) Del(key K)
- func (m *Map[K, V]) Flush()
- func (m *Map[K, V]) Get(key K) (V, bool)
- func (m *Map[K, V]) Len() int
- func (m *Map[K, V]) RangeDo(f func(k K, v V) (newV V, setV, delV bool, err error)) error
- func (m *Map[K, V]) Set(key K, v V)
- func (m *Map[K, V]) TestAndSet(key K, f func(v V, ok bool) (newV V, setV, delV bool))
- type TestAndSetFunc
Constants ¶
View Source
const (
MapShardSize = 64
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hashable ¶
type Hashable interface { comparable Sum() uint64 }
type Map ¶
func NewMapCache ¶
NewMapCache returns a cache with a maximum size. Note that, because this it has multiple (MapShardSize) shards, the actual maximum size is MapShardSize*(size / MapShardSize). If size <=0, it's equal to NewMap().
func (*Map[K, V]) TestAndSet ¶
type TestAndSetFunc ¶
type TestAndSetFunc[K comparable, V any] func(key K, v V, ok bool) (newV V, setV, deleteV bool)
Click to show internal directories.
Click to hide internal directories.