DistributedCacheExtensions.SetAsync Metodo

Definizione

Overload

SetAsync(IDistributedCache, String, Byte[])

Imposta in modo asincrono una sequenza di byte nella cache specificata con la chiave specificata.

SetAsync(IDistributedCache, String, Byte[], CancellationToken)

Imposta in modo asincrono una sequenza di byte nella cache specificata con la chiave specificata.

SetAsync(IDistributedCache, String, Byte[])

Imposta in modo asincrono una sequenza di byte nella cache specificata con la chiave specificata.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task ^ SetAsync(Microsoft::Extensions::Caching::Distributed::IDistributedCache ^ cache, System::String ^ key, cli::array <System::Byte> ^ value);
public static System.Threading.Tasks.Task SetAsync (this Microsoft.Extensions.Caching.Distributed.IDistributedCache cache, string key, byte[] value);
static member SetAsync : Microsoft.Extensions.Caching.Distributed.IDistributedCache * string * byte[] -> System.Threading.Tasks.Task
<Extension()>
Public Function SetAsync (cache As IDistributedCache, key As String, value As Byte()) As Task

Parametri

cache
IDistributedCache

Cache in cui archiviare i dati.

key
String

Chiave in cui archiviare i dati.

value
Byte[]

Dati da archiviare nella cache.

Restituisce

Attività che rappresenta l'operazione set asincrona.

Eccezioni

key o value è null.

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(IDistributedCache, String, Byte[]).

Si applica a

SetAsync(IDistributedCache, String, Byte[], CancellationToken)

Source:
DistributedCacheExtensions.cs
Source:
DistributedCacheExtensions.cs
Source:
DistributedCacheExtensions.cs

Imposta in modo asincrono una sequenza di byte nella cache specificata con la chiave specificata.

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

Parametri

cache
IDistributedCache

Cache in cui archiviare i dati.

key
String

Chiave in cui archiviare i dati.

value
Byte[]

Dati da archiviare nella cache.

token
CancellationToken

facoltativo. Oggetto CancellationToken per annullare l'operazione.

Restituisce

Attività che rappresenta l'operazione set asincrona.

Eccezioni

key o value è null.

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(IDistributedCache, String, Byte[]).

Si applica a