IReliableDictionary3<TKey,TValue>.TryRemoveAsync 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
TryRemoveAsync(ITransaction, TKey, Int64) |
(Beta) Attempts to remove the value with the specified key given the sequence number is matching. |
TryRemoveAsync(ITransaction, TKey, Int64, TimeSpan, CancellationToken) |
(Beta) Attempts to remove the value with the specified key given the sequence number is matching. |
TryRemoveAsync(ITransaction, TKey, Int64)
(Beta) Attempts to remove the value with the specified key given the sequence number is matching.
public System.Threading.Tasks.Task<bool> TryRemoveAsync (Microsoft.ServiceFabric.Data.ITransaction tx, TKey key, long checkSequenceNumber);
abstract member TryRemoveAsync : Microsoft.ServiceFabric.Data.ITransaction * 'Key * int64 -> System.Threading.Tasks.Task<bool>
Public Function TryRemoveAsync (tx As ITransaction, key As TKey, checkSequenceNumber As Long) As Task(Of Boolean)
Parameters
- tx
- ITransaction
Transaction to associate this operation with.
- key
- TKey
The key of the element to remove.
- checkSequenceNumber
- Int64
The expected sequence number of the element to be removed.
Returns
Task that represents the asynchronous remove operation. The task result is a tuple indicating whether the key was removed from the Reliable Dictionary and if so, the value.
Exceptions
tx
is null, or key
is null or cannot be serialized.
The operation failed to complete within the given timeout.
The operation was canceled.
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
TryRemoveAsync(ITransaction, TKey, Int64, TimeSpan, CancellationToken)
(Beta) Attempts to remove the value with the specified key given the sequence number is matching.
public System.Threading.Tasks.Task<bool> TryRemoveAsync (Microsoft.ServiceFabric.Data.ITransaction tx, TKey key, long checkSequenceNumber, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
abstract member TryRemoveAsync : Microsoft.ServiceFabric.Data.ITransaction * 'Key * int64 * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Function TryRemoveAsync (tx As ITransaction, key As TKey, 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 remove.
- checkSequenceNumber
- Int64
The expected sequence number of the element to be removed.
- 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
Task that represents the asynchronous remove operation. The task result is a tuple indicating whether the key was removed from the Reliable Dictionary and if so, the value.
Exceptions
tx
is null, or key
is null or cannot be serialized.
timeout
is negative.
The operation failed to complete within the given timeout.
The operation was canceled.
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.