Partilhar via


ICacheService.CheckExistsAsync Method

Definition

Overloads

CheckExistsAsync(CacheItemKey, CancellationToken)

Checks whether a value exists in the cache.

CheckExistsAsync(CacheItemKey, Boolean, CancellationToken)

Checks whether a value exists in the cache.

CheckExistsAsync(CacheItemKey, CancellationToken)

Checks whether a value exists in the cache.

public:
 System::Threading::Tasks::Task<bool> ^ CheckExistsAsync(Microsoft::VisualStudio::RpcContracts::Caching::CacheItemKey key, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<bool> CheckExistsAsync (Microsoft.VisualStudio.RpcContracts.Caching.CacheItemKey key, System.Threading.CancellationToken cancellationToken);
abstract member CheckExistsAsync : Microsoft.VisualStudio.RpcContracts.Caching.CacheItemKey * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Function CheckExistsAsync (key As CacheItemKey, cancellationToken As CancellationToken) As Task(Of Boolean)

Parameters

key
CacheItemKey

The key of the value to access.

cancellationToken
CancellationToken

Cancellation token to monitor.

Returns

true if a value for these inputs exist; false otherwise.

Exceptions

Thrown if cancellationToken is cancelled.

Thrown if this instance has already been disposed.

Thrown when the operation cannot be completed due to a failure in cache storage access.

Remarks

When the service is acquired with the CacheService descriptor or later, this method will not detect values that were downloaded from another machine. Use the CheckExistsAsync(CacheItemKey, Boolean, CancellationToken) overload to allow or explicitly disallow sharing.

Applies to

CheckExistsAsync(CacheItemKey, Boolean, CancellationToken)

Checks whether a value exists in the cache.

public System.Threading.Tasks.Task<bool> CheckExistsAsync (Microsoft.VisualStudio.RpcContracts.Caching.CacheItemKey key, bool shareable, System.Threading.CancellationToken cancellationToken);
abstract member CheckExistsAsync : Microsoft.VisualStudio.RpcContracts.Caching.CacheItemKey * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Function CheckExistsAsync (key As CacheItemKey, shareable As Boolean, cancellationToken As CancellationToken) As Task(Of Boolean)

Parameters

key
CacheItemKey

The key of the value to access.

shareable
Boolean

A value indicating whether the value is allowed or expected to have come from another machine.

cancellationToken
CancellationToken

Cancellation token to monitor.

Returns

true if a value for these inputs exist; false otherwise.

Exceptions

Thrown if cancellationToken is cancelled.

Thrown if this instance has already been disposed.

Thrown when the operation cannot be completed due to a failure in cache storage access.

Remarks

This method overload was added in Visual Studio 2022 Update 2.

Applies to