MemoryCache Class¶
An implementation of Microsoft.Extensions.Caching.Memory.IMemoryCache using a dictionary to
store its entries.
- Namespace
Microsoft.Extensions.Caching.Memory- Assemblies
- Microsoft.Extensions.Caching.Memory
Syntax¶
public class MemoryCache : IMemoryCache, IDisposable
-
class
Microsoft.Extensions.Caching.Memory.MemoryCache
Constructors¶
-
MemoryCache(Microsoft.Extensions.Options.IOptions<Microsoft.Extensions.Caching.Memory.MemoryCacheOptions>)¶ Creates a new
Microsoft.Extensions.Caching.Memory.MemoryCacheinstance.Arguments: optionsAccessor (Microsoft.Extensions.Options.IOptions<Microsoft.Extensions.Caching.Memory.MemoryCacheOptions>) – The options of the cache. public MemoryCache(IOptions<MemoryCacheOptions> optionsAccessor)
-
Methods¶
-
Compact(System.Double)¶ public void Compact(double percentage)
-
CreateEntry(System.Object)¶ Return type: Microsoft.Extensions.Caching.Memory.ICacheEntry public ICacheEntry CreateEntry(object key)
-
Dispose()¶ public void Dispose()
-
Dispose(System.Boolean) protected virtual void Dispose(bool disposing)
-
Finalize()¶ Cleans up the background collection events.
protected void Finalize()
-
Remove(System.Object)¶ public void Remove(object key)
-
TryGetValue(System.Object, out System.Object)¶ Return type: System.Boolean public bool TryGetValue(object key, out object result)
-
Properties¶
-
Microsoft.Extensions.Caching.Memory.MemoryCache.Count¶ Gets the count of the current entries for diagnostic purposes.
Return type: System.Int32 public int Count { get; }
-