Documentation ¶
Index ¶
- type Map
- func (m *Map) Clone() *Map
- func (m *Map) Count() int
- func (m *Map) Delete(key uint32)
- func (m *Map) Load(key uint32) (uint32, bool)
- func (m *Map) Range(fn func(key, value uint32) bool)
- func (m *Map) RangeEach(fn func(key, value uint32))
- func (m *Map) RangeErr(fn func(key, value uint32) error) error
- func (m *Map) Store(key, val uint32)
- type Sync
- func (m *Sync) Count() (count int)
- func (m *Sync) Delete(key uint32)
- func (m *Sync) Load(key uint32) (value uint32, ok bool)
- func (m *Sync) LoadOrStore(key uint32, fn func() uint32) (value uint32, loaded bool)
- func (m *Sync) Range(f func(key, value uint32) bool)
- func (m *Sync) Store(key, val uint32)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map is a map-like data-structure for int64s
func New ¶
New returns a map initialized with n spaces and uses the stated fillFactor. The map will grow as needed.
func (*Map) Load ¶
Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.
func (*Map) Range ¶
Range calls f sequentially for each key and value present in the map. If fn returns false, range stops the iteration.
func (*Map) RangeEach ¶ added in v1.3.0
RangeEach calls f sequentially for each key and value present in the map.
type Sync ¶ added in v1.1.0
type Sync struct {
// contains filtered or unexported fields
}
Sync is a thread-safe, map-like data-structure for int64s
func NewSync ¶ added in v1.1.0
NewSync returns a thread-safe map initialized with n spaces and uses the stated fillFactor. The map will grow as needed.
func (*Sync) Load ¶ added in v1.1.0
Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.
func (*Sync) LoadOrStore ¶ added in v1.1.0
LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value returned by the handler. The loaded result is true if the value was loaded, false if stored.