Freigeben über


CacheServiceExtensions.SetItemAsync Method

Definition

Tries to add an item to cache and return a unique key. Stream will be read till end to determine content and size.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task ^ SetItemAsync(Microsoft::VisualStudio::RpcContracts::Caching::ICacheService ^ cacheService, Microsoft::VisualStudio::RpcContracts::Caching::CacheItemKey key, System::IO::Stream ^ content, bool shareable, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task SetItemAsync (this Microsoft.VisualStudio.RpcContracts.Caching.ICacheService cacheService, Microsoft.VisualStudio.RpcContracts.Caching.CacheItemKey key, System.IO.Stream content, bool shareable, System.Threading.CancellationToken cancellationToken);
static member SetItemAsync : Microsoft.VisualStudio.RpcContracts.Caching.ICacheService * Microsoft.VisualStudio.RpcContracts.Caching.CacheItemKey * System.IO.Stream * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function SetItemAsync (cacheService As ICacheService, key As CacheItemKey, content As Stream, shareable As Boolean, cancellationToken As CancellationToken) As Task

Parameters

cacheService
ICacheService

The cache service.

key
CacheItemKey

The key of the value to access.

content
Stream
shareable
Boolean

A value indicating whether the value, item name, and container key are all portable for sharing with other machines.

cancellationToken
CancellationToken

Cancellation token to monitor.

Returns

A Task that completes when the cache entry has been written.

Applies to