NamedMapTKey, TValueAddOrUpdate Method (TKey, TValue, FuncTKey, TValue, TValue)

ScaleOut Software NamedCache API

Namespace:  Soss.Client.Concurrent
Assembly:  soss_namedcache (in soss_namedcache.dll) Version: 6.2.0.0
Syntax

public TValue AddOrUpdate(
	TKey key,
	TValue addValue,
	Func<TKey, TValue, TValue> updateValueFactory
)

Parameters

key
Type: TKey
The key to be added or whose value should be updated.
addValue
Type: TValue
The function used to generate a value for an absent key.
updateValueFactory
Type: SystemFuncTKey, TValue, TValue
The function used to generate a new value for an existing key based on the key's existing value

Return Value

Type: TValue
A new value for the key. This will be either addValue (if the key was absent) or the result of updateValueFactory (if the key was present).
Exceptions

ExceptionCondition
ArgumentNullExceptionThrown if key is a null reference or updateValueFactory is a null reference.
TimeoutExceptionThrown when the maximum number of internal retries reached.
See Also

Reference