DistributedCacheExtensions.SetAsync 方法    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
使用指定的键异步设置指定缓存中的字节序列。
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
	参数
- cache
 - IDistributedCache
 
要在其中存储数据的缓存。
- key
 - String
 
要在其中存储数据的键。
- value
 - Byte[]
 
要存储在缓存中的数据。
- token
 - CancellationToken
 
自选。 用于取消操作的 CancellationToken。
返回
表示异步集操作的任务。
例外
取消令牌已取消。 此异常存储在返回的任务中。
              key 或 value 为 null。
注解
此方法存储在任务中,它返回该方法的同步对应项可以引发的所有非使用异常。 如果异常存储在返回的任务中,则等待任务时将引发该异常。 使用异常(如 ArgumentException)仍同步引发。 有关存储的异常,请参阅 Set(IDistributedCache, String, Byte[])引发的异常。