You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// LoadOrStoreFunc is like LoadOrStore, but receives a function to provide the value.
func (m *Map) LoadOrStoreFunc(key any, valueFunc func() any) (actual any, loaded bool)
Sometimes I don’t immediately know the value to store, and it’s a heavy operation to get the value, I’d like use LoadOrStoreFunc to compute the value lazily. Maybe it’s worth adding this method.
The text was updated successfully, but these errors were encountered:
Proposal Details
I propose adding
Map.LoadOrStoreFunc
method:Sometimes I don’t immediately know the value to store, and it’s a heavy operation to get the value, I’d like use
LoadOrStoreFunc
to compute the value lazily. Maybe it’s worth adding this method.The text was updated successfully, but these errors were encountered: