IReliableDictionary3<TKey,TValue>.TryUpdateAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
TryUpdateAsync(ITransaction, TKey, TValue, Int64) |
(Beta) Attempts to update the value for the specified key given the sequence number is matching. |
TryUpdateAsync(ITransaction, TKey, TValue, Int64, TimeSpan, CancellationToken) |
(Beta) Attempts to update the value for the specified key given the sequence number is matching. |
TryUpdateAsync(ITransaction, TKey, TValue, Int64)
(Beta) Attempts to update the value for the specified key given the sequence number is matching.
public System.Threading.Tasks.Task<bool> TryUpdateAsync (Microsoft.ServiceFabric.Data.ITransaction tx, TKey key, TValue newValue, long checkSequenceNumber);
abstract member TryUpdateAsync : Microsoft.ServiceFabric.Data.ITransaction * 'Key * 'Value * int64 -> System.Threading.Tasks.Task<bool>
Public Function TryUpdateAsync (tx As ITransaction, key As TKey, newValue As TValue, checkSequenceNumber As Long) As Task(Of Boolean)
Parameters
- tx
- ITransaction
Transaction to associate this operation with.
- key
- TKey
The key of the element to be updated.
- newValue
- TValue
The value to be updated to if the specified key
has the expected checkSequenceNumber
.
- checkSequenceNumber
- Int64
The expected sequence number of the element to be updated.
Returns
A task that represents the asynchronous update operation. The task result indicates whether the object was updated.
Exceptions
tx
is null, or key
is null or cannot be serialized.
The operation failed to complete within the default timeout.
The exception that is thrown when the IReliableDictionary<TKey,TValue> is not in Primary.
The transaction has been internally faulted by the system. Retry the operation on a new transaction
Thrown when a method call is invalid for the object's current state. Example, transaction used is already terminated: committed or aborted by the user. If this exception is thrown, it is highly likely that there is a bug in the service code of the use of transactions.
Indicates that the Reliable Dictionary is closed or deleted.
Applies to
TryUpdateAsync(ITransaction, TKey, TValue, Int64, TimeSpan, CancellationToken)
(Beta) Attempts to update the value for the specified key given the sequence number is matching.
public System.Threading.Tasks.Task<bool> TryUpdateAsync (Microsoft.ServiceFabric.Data.ITransaction tx, TKey key, TValue newValue, long checkSequenceNumber, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
abstract member TryUpdateAsync : Microsoft.ServiceFabric.Data.ITransaction * 'Key * 'Value * int64 * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Function TryUpdateAsync (tx As ITransaction, key As TKey, newValue As TValue, checkSequenceNumber As Long, timeout As TimeSpan, cancellationToken As CancellationToken) As Task(Of Boolean)
Parameters
- tx
- ITransaction
Transaction to associate this operation with.
- key
- TKey
The key of the element to be updated.
- newValue
- TValue
The value to be updated to if the specified key
has the expected checkSequenceNumber
.
- checkSequenceNumber
- Int64
The expected sequence number of the element to be updated.
- timeout
- TimeSpan
The amount of time to wait for the operation to complete before throwing a TimeoutException. Primarily used to prevent deadlocks. The default is 4 seconds.
- cancellationToken
- CancellationToken
The token to monitor for cancellation requests. The default is None.
Returns
A task that represents the asynchronous update operation. The task result indicates whether the object was updated.
Exceptions
tx
is null, or key
is null or cannot be serialized.
The operation failed to complete within the default timeout.
The exception that is thrown when the IReliableDictionary<TKey,TValue> is not in Primary.
The transaction has been internally faulted by the system. Retry the operation on a new transaction
Thrown when a method call is invalid for the object's current state. Example, transaction used is already terminated: committed or aborted by the user. If this exception is thrown, it is highly likely that there is a bug in the service code of the use of transactions.
Indicates that the Reliable Dictionary is closed or deleted.
Applies to
Azure SDK for .NET