IMemoryCache Interface
Definition
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.
Represents a local in-memory cache whose values are not serialized.
public interface class IMemoryCache : IDisposable
public interface IMemoryCache : IDisposable
type IMemoryCache = interface
interface IDisposable
Public Interface IMemoryCache
Implements IDisposable
- Derived
- Implements
Methods
CreateEntry(Object) |
Create or overwrite an entry in the cache. |
Dispose() |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable) |
GetCurrentStatistics() |
Gets a snapshot of the cache statistics if available. |
Remove(Object) |
Removes the object associated with the given key. |
TryGetValue(Object, Object) |
Gets the item associated with this key if present. |
Extension Methods
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>) |
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) |
Associates a value with the specified key in the IMemoryCache. |
Set<TItem>(IMemoryCache, Object, TItem, MemoryCacheEntryOptions) |
Associates a cache entry with the specified key and applies the values of an existing MemoryCacheEntryOptions to the created entry. |
Set<TItem>(IMemoryCache, Object, TItem, IChangeToken) |
Associates a cache entry with the specified key that will expire when IChangeToken expires. |
Set<TItem>(IMemoryCache, Object, TItem, DateTimeOffset) |
Creates or overwrites the specified entry in the cache and sets the value with an absolute expiration date. |
Set<TItem>(IMemoryCache, Object, TItem, TimeSpan) |
Associates a cache entry with a specified key that will expire after a specified duration. |
TryGetValue<TItem>(IMemoryCache, Object, TItem) |
Tries to get the value associated with a specified key. |
Applies to
Feedback
Submit and view feedback for