Compartir a través de


ICacheService.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::Threading::Tasks::Task ^ SetItemAsync(Microsoft::VisualStudio::RpcContracts::Caching::CacheItemKey key, System::IO::Pipelines::PipeReader ^ reader, bool shareable, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task SetItemAsync (Microsoft.VisualStudio.RpcContracts.Caching.CacheItemKey key, System.IO.Pipelines.PipeReader reader, bool shareable, System.Threading.CancellationToken cancellationToken);
abstract member SetItemAsync : Microsoft.VisualStudio.RpcContracts.Caching.CacheItemKey * System.IO.Pipelines.PipeReader * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SetItemAsync (key As CacheItemKey, reader As PipeReader, shareable As Boolean, cancellationToken As CancellationToken) As Task

Parameters

key
CacheItemKey

The key of the value to access.

reader
PipeReader

Reader to utilize for reading contents of the entry.

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.

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.

Thrown when caller has no write permissions.

Applies to