DistributedCacheExtensions.Set(IDistributedCache, String, Byte[]) 方法

定义

使用指定的键设置指定缓存中的字节序列。

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

参数

cache
IDistributedCache

用于存储数据的缓存。

key
String

用于存储数据的键。

value
Byte[]

要存储在缓存中的数据。

例外

keyvalue 为 null。

适用于