Mapsync.Map
dirty contains the portion of the map's contents that require mu to be
held. To ensure that the dirty map can be promoted to the read map quickly,
it also includes all of the non-expunged entries in the read map.
Expunged entries are not stored in the dirty map. An expunged entry in the
clean map must be unexpunged and added to the dirty map before a new value
can be stored to it.
If the dirty map is nil, the next write to the map will initialize it by
making a shallow copy of the clean map, omitting stale entries.
misses counts the number of loads since the read map was last updated that
needed to lock mu to determine whether the key was present.
Once enough misses have occurred to cover the cost of copying the dirty
map, the dirty map will be promoted to the read map (in the unamended
state) and the next store to the map will make a new dirty copy.
Map.musync.Mutex
read contains the portion of the map's contents that are safe for
concurrent access (with or without mu held).
The read field itself is always safe to load, but must only be stored with
mu held.
Entries stored in read may be updated concurrently without mu, but updating
a previously-expunged entry requires that the entry be copied to the dirty
map and unexpunged with mu held.
// readOnly
Delete deletes the value for a key.
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.
LoadAndDelete deletes the value for a key, returning the previous value if any.
The loaded result reports whether the key was present.
LoadOrStore returns the existing value for the key if present.
Otherwise, it stores and returns the given value.
The loaded result is true if the value was loaded, false if stored.
Range calls f sequentially for each key and value present in the map.
If f returns false, range stops the iteration.
Range does not necessarily correspond to any consistent snapshot of the Map's
contents: no key will be visited more than once, but if the value for any key
is stored or deleted concurrently, Range may reflect any mapping for that key
from any point during the Range call.
Range may be O(N) with the number of elements in the map even if f returns
false after a constant number of calls.
Store sets the value for a key.
(*T) dirtyLocked()(*T) missLocked()
func NewMap() *Map
var github.com/json-iterator/go.cfgCache *Map
The pages are generated with Goldsv0.3.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.