แก้ไข

แชร์ผ่าน


MemoryCache.Item[String] Property

Definition

Gets or sets a value in the cache by using the default indexer property for an instance of the MemoryCache class.

public:
 virtual property System::Object ^ default[System::String ^] { System::Object ^ get(System::String ^ key); void set(System::String ^ key, System::Object ^ value); };
public override object this[string key] { get; set; }
member this.Item(string) : obj with get, set
Default Public Overrides Property Item(key As String) As Object

Parameters

key
String

A unique identifier for the cache value to get or set.

Property Value

The value in the cache instance for the specified key, if the entry exists; otherwise, null.

Exceptions

key is null.

-or-

The inserted value is null.

Remarks

When you set this property, the value is inserted into the cache. The expiration policy for the cache entry is set to InfiniteAbsoluteExpiration. If a cache entry with a matching key already exists, its value is updated.

Applies to