Click or drag to resize

IGlobalCacheTryReplace Method

Attempt to replace the value for a given key. This method is thread-safe. Note that there is no guarantee that any call to TryReplace method will succeed; it will fail (return false) if another thread changed the underlying value (oldValue). To guarantee a successful replacement, TryGet and TryReplace methods need to be called in a loop until TryReplace returns true. Alternatively, ReplaceValue method may be called, which executes such loop internally.

Namespace:  Mavidian.DataConveyer.Orchestrators
Assembly:  DataConveyer (in DataConveyer.dll) Version: 3.4.6+1324144ff7
Syntax
bool TryReplace(
	string key,
	Object newValue,
	Object oldValue
)

Parameters

key
Type: SystemString
Key of the value to replace.
newValue
Type: SystemObject
New value to be placed in GlobalCache for the key.
oldValue
Type: SystemObject
Current value for the key (to be compared against the underlying value in GlobalCache).

Return Value

Type: Boolean
True if the value was successfully replaced; false if the oldValue didn't match the underlying value in GlobalCache and hence no replacement took place.
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptionNo element for a given key is present in GlobalCache.
See Also