PostSharp 6.8 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Caching.​Backends Namespace / Memory­Cache­Backend Class / Memory­Cache­Backend Constructor / Memory­Cache­Backend Constructor (IMemory­Cache, Func(Cache­Item, Int64))

MemoryCacheBackend Constructor (IMemoryCache, Func<CacheItem, Int64>)

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

Namespace:  PostSharp.Patterns.Caching.Backends
Assembly:  PostSharp.Patterns.Caching.Backends.IMemoryCache (in PostSharp.Patterns.Caching.Backends.IMemoryCache.dll) Version: 6.8.6.0 (6.8.6.0)
Syntax
C#
public MemoryCacheBackend(
	IMemoryCache cache,
	Func<CacheItem, long> sizeCalculator
)

Parameters

cache
Type: IMemoryCache
An IMemoryCache.
sizeCalculator
Type: System.Func<CacheItem, Int64>
A function that calculates the size of a new cache item, which some backends may use to evict.
See Also