PDFium Delphi Component Docs

ThumbnailCacheStatistics property

Component: TPdf  ·  Unit: PDFium
Returns entry, byte, hit, miss and eviction telemetry for the revision-aware thumbnail cache

Syntax

property ThumbnailCacheStatistics: TPdfThumbnailCacheStatistics; // read only

 

type TPdfThumbnailCacheStatistics = record
  EntryCount: Integer;
  StoredBytes: Int64;
  HitCount: Int64;
  MissCount: Int64;
  EvictionCount: Int64;
end;

EntryCountRetained entries, counting positive bitmap entries and cached absence of optional embedded thumbnails
StoredBytesEstimated bitmap memory as width times height times four bytes; zero-byte negative entries add nothing
HitCountCumulative lookups served from a retained entry
MissCountCumulative lookups that had to extract or render, including every lookup made whilst retention is disabled
EvictionCountCumulative entries dropped by least-recently-use pressure or ceiling shrinkage

Description

Repeated ExtractThumbnail and RenderPageThumbnail calls contribute hits and misses under the same render lock used by native PDFium page access, so the counters move only through the documented lookup paths

Every successful bitmap lookup returns a deep caller-owned copy, so freeing or modifying a returned bitmap cannot affect a later hit, and the cached entry keeps its measured bytes until it is evicted or invalidated

Counters are cumulative for the lifetime of the TPdf instance. ClearThumbnailCache and the internal invalidation paths preserve them

Remarks

An eviction is counted when ceiling pressure drops a retained entry, including the governor evicting thumbnails to honour CacheBudgetBytes; dropping entries because their page was edited is invalidation and does not grow EvictionCount

The read returns a zeroed record when the cache is unavailable, which in practice only happens outside the normal component lifetime

Example

Stats := Pdf.ThumbnailCacheStatistics;
LogThumbnailCache(Stats.EntryCount, Stats.HitCount, Stats.MissCount,
  Stats.EvictionCount);

See Also

ThumbnailCacheMaxEntries, ThumbnailCacheMaxBytes, ClearThumbnailCache, CacheGovernorStatistics, Thumbnail cache