Share via


IReliableDictionary<TKey,TValue>.ContainsKeyAsync Method

Definition

Overloads

ContainsKeyAsync(ITransaction, TKey, LockMode, TimeSpan, CancellationToken)

Determines whether the Reliable Dictionary contains the specified key.

ContainsKeyAsync(ITransaction, TKey, TimeSpan, CancellationToken)

Determines whether the Reliable Dictionary contains the specified key.

ContainsKeyAsync(ITransaction, TKey, LockMode)

Determines whether the Reliable Dictionary contains the specified key.

ContainsKeyAsync(ITransaction, TKey)

Determines whether the Reliable Dictionary contains the specified key.

ContainsKeyAsync(ITransaction, TKey, LockMode, TimeSpan, CancellationToken)

Determines whether the Reliable Dictionary contains the specified key.

public System.Threading.Tasks.Task<bool> ContainsKeyAsync (Microsoft.ServiceFabric.Data.ITransaction tx, TKey key, Microsoft.ServiceFabric.Data.Collections.LockMode lockMode, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
abstract member ContainsKeyAsync : Microsoft.ServiceFabric.Data.ITransaction * 'Key * Microsoft.ServiceFabric.Data.Collections.LockMode * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Function ContainsKeyAsync (tx As ITransaction, key As TKey, lockMode As LockMode, timeout As TimeSpan, cancellationToken As CancellationToken) As Task(Of Boolean)

Parameters

tx
ITransaction

Transaction to associate this operation with.

key
TKey

The key to locate in the Reliable Dictionary.

lockMode
LockMode

Type of locking to use for this read operation.

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 operation. The task result indicates whether the key exists.

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.

Indicates that the IReliableDictionary cannot serve reads at the moment. This exception can be thrown in all ReplicaRoles. One reason it may be thrown in the Primary role is loss of ReadStatus. One reason it may be thrown in the ActiveSecondary role is that Reliable Collection's state is not yet consistent.

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

ContainsKeyAsync(ITransaction, TKey, TimeSpan, CancellationToken)

Determines whether the Reliable Dictionary contains the specified key.

public System.Threading.Tasks.Task<bool> ContainsKeyAsync (Microsoft.ServiceFabric.Data.ITransaction tx, TKey key, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
abstract member ContainsKeyAsync : Microsoft.ServiceFabric.Data.ITransaction * 'Key * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Function ContainsKeyAsync (tx As ITransaction, key As TKey, timeout As TimeSpan, cancellationToken As CancellationToken) As Task(Of Boolean)

Parameters

tx
ITransaction

Transaction to associate this operation with.

key
TKey

The key to locate in the Reliable Dictionary.

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 operation. The task result indicates whether the key exists.

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.

Indicates that the IReliableDictionary cannot serve reads at the moment. This exception can be thrown in all ReplicaRoles. One reason it may be thrown in the Primary role is loss of ReadStatus. One reason it may be thrown in the ActiveSecondary role is that Reliable Collection's state is not yet consistent.

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

ContainsKeyAsync(ITransaction, TKey, LockMode)

Determines whether the Reliable Dictionary contains the specified key.

public System.Threading.Tasks.Task<bool> ContainsKeyAsync (Microsoft.ServiceFabric.Data.ITransaction tx, TKey key, Microsoft.ServiceFabric.Data.Collections.LockMode lockMode);
abstract member ContainsKeyAsync : Microsoft.ServiceFabric.Data.ITransaction * 'Key * Microsoft.ServiceFabric.Data.Collections.LockMode -> System.Threading.Tasks.Task<bool>
Public Function ContainsKeyAsync (tx As ITransaction, key As TKey, lockMode As LockMode) As Task(Of Boolean)

Parameters

tx
ITransaction

Transaction to associate this operation with.

key
TKey

The key to locate in the Reliable Dictionary.

lockMode
LockMode

Type of locking to use for this read operation.

Returns

A task that represents the asynchronous operation. The task result indicates whether the key exists.

Exceptions

tx is null, or key is null or cannot be serialized.

The operation failed to complete within the default timeout.

Indicates that the IReliableDictionary cannot serve reads at the moment. This exception can be thrown in all ReplicaRoles. One reason it may be thrown in the Primary role is loss of ReadStatus. One reason it may be thrown in the ActiveSecondary role is that Reliable Collection's state is not yet consistent.

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

ContainsKeyAsync(ITransaction, TKey)

Determines whether the Reliable Dictionary contains the specified key.

public System.Threading.Tasks.Task<bool> ContainsKeyAsync (Microsoft.ServiceFabric.Data.ITransaction tx, TKey key);
abstract member ContainsKeyAsync : Microsoft.ServiceFabric.Data.ITransaction * 'Key -> System.Threading.Tasks.Task<bool>
Public Function ContainsKeyAsync (tx As ITransaction, key As TKey) As Task(Of Boolean)

Parameters

tx
ITransaction

Transaction to associate this operation with.

key
TKey

The key to locate in the Reliable Dictionary.

Returns

A task that represents the asynchronous operation. The task result indicates whether the key exists.

Exceptions

tx is null, or key is null or cannot be serialized.

The operation failed to complete within the default timeout.

Indicates that the IReliableDictionary cannot serve reads at the moment. This exception can be thrown in all ReplicaRoles. One reason it may be thrown in the Primary role is loss of ReadStatus. One reason it may be thrown in the ActiveSecondary role is that Reliable Collection's state is not yet consistent.

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