IMemoryCacheManager.UpdateCacheSize(Int64, MemoryCache) Method

Definition

Reports the size of the current cache.

public:
 void UpdateCacheSize(long size, System::Runtime::Caching::MemoryCache ^ cache);
public void UpdateCacheSize (long size, System.Runtime.Caching.MemoryCache cache);
abstract member UpdateCacheSize : int64 * System.Runtime.Caching.MemoryCache -> unit
Public Sub UpdateCacheSize (size As Long, cache As MemoryCache)

Parameters

size
Int64

The size of the memory, in bytes, that the cache consumes.

cache
MemoryCache

A reference to the cache.

Remarks

A well-behaved cache implementation should use the UpdateCacheSize method to periodically report the size of the cache's memory footprint to the host environment.

The cache implementation that reports the size also passes a reference to itself as a parameter. This enables the host environment to perform the following tasks:

  • Maintain a list of known object caches.

  • Call the cache and request that the cache trim a percentage of cache items based on the reported size, if it is required.

Applies to