Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
CacheExtensions Class
Definition
- Namespace:
- Microsoft.Extensions.Caching.Memory
- Assembly:
- Microsoft.Extensions.Caching.Abstractions.dll
- Package:
- Microsoft.Extensions.Caching.Abstractions v11.0.0-preview.5.26302.115
- Source:
- MemoryCacheExtensions.cs
- Source:
- MemoryCacheExtensions.cs
- Source:
- MemoryCacheExtensions.cs
- Source:
- MemoryCacheExtensions.cs
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.
Provides extensions methods for IMemoryCache operations.
public ref class CacheExtensions abstract sealed
public static class CacheExtensions
type CacheExtensions = class
Public Module CacheExtensions
- Inheritance
-
CacheExtensions
Methods
| Name | Description |
|---|---|
| Get(IMemoryCache, Object) |
Gets the value associated with this key if present. |
| Get<TItem>(IMemoryCache, Object) |
Gets the value associated with this key if present. |
| GetOrCreate<TItem>(IMemoryCache, Object, Func<ICacheEntry,TItem>, MemoryCacheEntryOptions) |
Gets the value associated with this key if it exists, or generates a new entry using the provided key and a value from the given factory if the key is not found. |
| GetOrCreate<TItem>(IMemoryCache, Object, Func<ICacheEntry,TItem>) |
Gets the value associated with this key if it exists, or generates a new entry using the provided key and a value from the given factory if the key is not found. |
| GetOrCreateAsync<TItem>(IMemoryCache, Object, Func<ICacheEntry,Task<TItem>>, MemoryCacheEntryOptions) |
Asynchronously gets the value associated with this key if it exists, or generates a new entry using the provided key and a value from the given factory if the key is not found. |
| GetOrCreateAsync<TItem>(IMemoryCache, Object, Func<ICacheEntry,Task<TItem>>) |
Asynchronously gets the value associated with this key if it exists, or generates a new entry using the provided key and a value from the given factory if the key is not found. |
| Set<TItem>(IMemoryCache, Object, TItem, DateTimeOffset) |
Sets a cache entry with the given key and value that will expire in the given duration. |
| Set<TItem>(IMemoryCache, Object, TItem, IChangeToken) |
Sets a cache entry with the given key and value that will expire when IChangeToken expires. |
| Set<TItem>(IMemoryCache, Object, TItem, MemoryCacheEntryOptions) |
Sets a cache entry with the given key and value and apply the values of an existing MemoryCacheEntryOptions to the created entry. |
| Set<TItem>(IMemoryCache, Object, TItem, TimeSpan) |
Sets a cache entry with the given key and value that will expire in the given duration from now. |
| Set<TItem>(IMemoryCache, Object, TItem) |
Associate a value with a key in the IMemoryCache. |
| TryGetValue<TItem>(IMemoryCache, Object, TItem) |
Tries to get the value associated with the given key. |
Applies to
Feedback
Was this page helpful?
