PDFium Delphi Component Docs

ThumbnailCacheMaxBytes property

Component: TPdf  ·  Unit: PDFium
Sets the byte ceiling for the revision-aware thumbnail cache

Syntax

property ThumbnailCacheMaxBytes: Int64; // read and write, default 64 MiB

Description

Each retained thumbnail is measured as its bitmap width times height times four bytes, and StoredBytes in ThumbnailCacheStatistics reports the sum. Cached negative entries, the remembered absence of an embedded /Thumb, measure zero bytes

Retention requires this ceiling and ThumbnailCacheMaxEntries to both be positive, and an entry is kept only whilst both ceilings permit it. A single bitmap larger than this ceiling alone is never retained

Reducing the value evicts the least recently used entries immediately, and each dropped entry grows EvictionCount in ThumbnailCacheStatistics

Remarks

Setting the ceiling to zero disables retention whilst leaving extraction and rendering fully available; every lookup then counts as a miss

Negative values raise EPdfError

Retained entries also reserve their measured bytes in the shared CacheBudgetBytes governor, so this ceiling bounds the thumbnail cache specifically whilst the governor bounds the instance as a whole

The property is guarded by the render lock used by native PDFium page access, so changing it waits briefly for in-flight rendering

Example

Pdf.ThumbnailCacheMaxBytes := Int64(96) * 1024 * 1024;
Stats := Pdf.ThumbnailCacheStatistics;
LogThumbnailBytes(Stats.StoredBytes);

See Also

ThumbnailCacheMaxEntries, ThumbnailCacheStatistics, CacheBudgetBytes, ClearThumbnailCache, Thumbnail cache