MemoryDistributedCache.SetAsync Metodo

Definizione

Imposta in modo asincrono l'elemento specificato associato a una chiave in IMemoryCache come matrice di byte.

public System.Threading.Tasks.Task SetAsync(string key, byte[] value, Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions options, System.Threading.CancellationToken token = default);
abstract member SetAsync : string * byte[] * Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.SetAsync : string * byte[] * Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SetAsync (key As String, value As Byte(), options As DistributedCacheEntryOptions, Optional token As CancellationToken = Nothing) As Task

Parametri

key
String

Chiave dell'elemento da impostare.

value
Byte[]

Valore della matrice di byte dell'elemento da impostare.

options
DistributedCacheEntryOptions

Opzioni della cache per l'elemento da impostare.

token
CancellationToken

Oggetto CancellationToken da utilizzare per annullare l'operazione.

Valori restituiti

Attività per impostare il valore della matrice di byte associato alla chiave specificata nella cache.

Implementazioni

Eccezioni

Il token di annullamento è stato annullato. Questa eccezione viene archiviata nell'attività restituita.

Commenti

Questo metodo archivia nell'attività che restituisce tutte le eccezioni non di utilizzo che la controparte sincrona del metodo può generare. Se un'eccezione viene archiviata nell'attività restituita, tale eccezione verrà generata quando l'attività è attesa. Le eccezioni di utilizzo, ad esempio ArgumentException, vengono comunque generate in modo sincrono. Per le eccezioni archiviate, vedere le eccezioni generate da Set(String, Byte[], DistributedCacheEntryOptions).

Si applica a