Help me understand Go 1.9 sync.Map “LoadOrStore” method.


Help me understand Go 1.9 sync.Map “LoadOrStore” method.

I just read the Go 1.9 concurrent map documentation and the method LoadOrStore caught my attention.

"LoadOrStore" seems like a huge anti pattern: you're either loading, or your storing, you typically "shouldn't" be doing both or either in one operation. Can anyone explain the use case for an API like this? It's obviously a good enough use case for it to be in the 1.9 standard library.

Thoughts? 🙂

Submitted July 18, 2017 at 07:40PM by JackOhBlades
via reddit http://ift.tt/2vezhog

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s