CacheServiceExtensions.TryGetItemAsync 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
TryGetItemAsync(ICacheService, CacheItemKey, CancellationToken) |
Tries to retrieve an item from cache that is assigned to a particular key. |
TryGetItemAsync(ICacheService, CacheItemKey, Boolean, CancellationToken) |
Tries to retrieve an item from cache that is assigned to a particular key. |
TryGetItemAsync(ICacheService, CacheItemKey, CancellationToken)
Tries to retrieve an item from cache that is assigned to a particular key.
public:
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<System::IO::Stream ^> ^ TryGetItemAsync(Microsoft::VisualStudio::RpcContracts::Caching::ICacheService ^ cacheService, Microsoft::VisualStudio::RpcContracts::Caching::CacheItemKey key, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task<System.IO.Stream?> TryGetItemAsync (this Microsoft.VisualStudio.RpcContracts.Caching.ICacheService cacheService, Microsoft.VisualStudio.RpcContracts.Caching.CacheItemKey key, System.Threading.CancellationToken cancellationToken);
static member TryGetItemAsync : Microsoft.VisualStudio.RpcContracts.Caching.ICacheService * Microsoft.VisualStudio.RpcContracts.Caching.CacheItemKey * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.IO.Stream>
<Extension()>
Public Function TryGetItemAsync (cacheService As ICacheService, key As CacheItemKey, cancellationToken As CancellationToken) As Task(Of Stream)
Parameters
- cacheService
- ICacheService
The cache service.
- key
- CacheItemKey
The key of the value to access.
- cancellationToken
- CancellationToken
Cancellation token to monitor.
Returns
The stream carrying the cache value content, if the cached entry was found; otherwise null
.
Applies to
TryGetItemAsync(ICacheService, CacheItemKey, Boolean, CancellationToken)
Tries to retrieve an item from cache that is assigned to a particular key.
public static System.Threading.Tasks.Task<System.IO.Stream?> TryGetItemAsync (this Microsoft.VisualStudio.RpcContracts.Caching.ICacheService cacheService, Microsoft.VisualStudio.RpcContracts.Caching.CacheItemKey key, bool shareable, System.Threading.CancellationToken cancellationToken);
static member TryGetItemAsync : Microsoft.VisualStudio.RpcContracts.Caching.ICacheService * Microsoft.VisualStudio.RpcContracts.Caching.CacheItemKey * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.IO.Stream>
<Extension()>
Public Function TryGetItemAsync (cacheService As ICacheService, key As CacheItemKey, shareable As Boolean, cancellationToken As CancellationToken) As Task(Of Stream)
Parameters
- cacheService
- ICacheService
The cache service.
- key
- CacheItemKey
The key of the value to access.
- shareable
- Boolean
- cancellationToken
- CancellationToken
Cancellation token to monitor.
Returns
The stream carrying the cache value content, if the cached entry was found; otherwise null
.