Interface IMemoryCacheSizeReporter
Reports the approximate size of an in-memory cache, for diagnostics and observability.
Namespace: Umbraco.Cms.Core.Cache
Assembly: Umbraco.Core.dll
Syntax
public interface IMemoryCacheSizeReporter
Remarks
Implemented by in-memory caches whose footprint scales with the size of the content tree, so their retained entry count can be logged (e.g. by a periodic diagnostics job) during full-tree operations such as reindexing or crawling the published site.
The reported value is an approximate entry count, not a byte measurement: per-entry size varies widely, so the count is intended as a trend signal (a count that grows during a tree-walk and never falls indicates unbounded retention) and for attribution (which cache is largest when the process heap grows), rather than as an absolute memory figure. Absolute bytes are obtained from process-level totals (managed heap / working set) and a GC dump. The count is read without locking.
Properties
View SourceCacheName
Gets a human-readable name identifying the cache in diagnostic output.
Declaration
string CacheName { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
View SourceGetApproximateBytes()
Gets an approximate retained size of the cache in bytes, or null when the cache cannot be
cheaply sized.
Declaration
long? GetApproximateBytes()
Returns
| Type | Description |
|---|---|
| long? | The approximate size in bytes, or |
Remarks
Where provided, this is a coarse estimate (underlying content / structural size, not a precise managed-heap measurement) for the same trend/attribution purpose as the entry count. Absolute bytes come from a GC dump.
GetApproximateCount()
Gets the approximate number of entries currently retained in the cache.
Declaration
long GetApproximateCount()
Returns
| Type | Description |
|---|---|
| long | The approximate entry count. |