forked from orcaman/concurrent-map
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upsert method - inserts new or updates existing element
Upsert method uses callback which return value is inserted into a map. Callback is given 3 arguments: - exists - whether given key already exists in map - valueInMap - existing value in map - valueBeingAdded - value which was passed to Upsert method Return value of a callback is used to save new value in map. This approach allows map users to do non-trivial transformations of value stored in map, while still protected by a lock It is somewhat ovelaps with orcaman#29, but more generic and allows more use cases
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters