MemoryCache.Item[String] Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- key
- String
A unique identifier for the cache value to get or set.
The value in the cache instance for the specified key, if the entry exists; otherwise, null
.
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.
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided) |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: