PostSharp.ILAPI ReferencePost­Sharp.​Patterns.​Caching.​BackendsMemory­Cache­BackendMemory­Cache­Backend
Open sandboxFocus

MemoryCacheBackend Constructor

MemoryCacheBackend()

Initializes a new MemoryCacheBackend based on a new instance of the MemoryCache class.

Declaration
public MemoryCacheBackend()

MemoryCacheBackend(IMemoryCache)

Initializes a new MemoryCacheBackend based on the given Microsoft.Extensions.Caching.Memory.IMemoryCache.

Declaration
public MemoryCacheBackend([Required] IMemoryCache cache)
Parameters
Type Name Description
Microsoft.Extensions.Caching.Memory.IMemoryCache cache

An Microsoft.Extensions.Caching.Memory.IMemoryCache.

MemoryCacheBackend(IMemoryCache, Func<CacheItem, Int64>)

Initializes a new MemoryCacheBackend based on the given Microsoft.Extensions.Caching.Memory.IMemoryCache. The backend creates cache entries with size calculated by the given function.

Declaration
public MemoryCacheBackend([Required] IMemoryCache cache, Func<CacheItem, long> sizeCalculator)
Parameters
Type Name Description
Microsoft.Extensions.Caching.Memory.IMemoryCache cache

An Microsoft.Extensions.Caching.Memory.IMemoryCache.

Func<CacheItem, System.Int64> sizeCalculator

A function that calculates the size of a new cache item, which some backends may use to evict.