Open sandboxFocus

Constructor MemoryCacheBackend

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 IMemoryCache.

Declaration
public MemoryCacheBackend(IMemoryCache cache)
Parameters
Type Name Description
IMemoryCache cache

An IMemoryCache.

MemoryCacheBackend(IMemoryCache, Func<CacheItem, long>)

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

Declaration
public MemoryCacheBackend(IMemoryCache cache, Func<CacheItem, long> sizeCalculator)
Parameters
Type Name Description
IMemoryCache cache

An IMemoryCache.

Func<CacheItem, long> sizeCalculator

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