PDFium Delphi Component Docs

FPdfCache unit

Unit: FPdfCache
Provides a shared byte-budget governor for retained PDF data whose owners can release entries on demand

Types

TypeDescription
EPdfCacheErrorReports invalid budgets, entry sizes, and participants
TPdfCacheKindClassifies page scenes (pckPageScene), tiles (pckTile), thumbnails (pckThumbnail), system fonts (pckSystemFont), structure data (pckStructure), text snapshots (pckTextSnapshot), page-object snapshots (pckPageObjectSnapshot), decoded streams (pckDecodedStream), and application entries (pckApplication)
TPdfCacheGovernorStatisticsReports the budget, current and peak retained bytes, pinned bytes, entry count, reservations, touches, evictions, and rejections; fields include MaxBytes, StoredBytes, PeakStoredBytes, PinnedBytes, EntryCount, ReservationCount, TouchCount, EvictionCount, RejectionCount
TPdfCacheParticipantReceives synchronous EvictCacheEntry callbacks after the governor has removed a token from its accounting
TPdfCacheGovernorEntryInternal accounting record exposed for compiler compatibility; fields include Token, Participant, Kind, StoredBytes, LastUsed, and Pinned
TPdfCacheGovernorThread-safe token registry with one global least-recently-used order across participants and cache kinds

TPdfCacheGovernor members

MemberDescription
Create(AMaxBytes: Int64)Creates a governor with a non-negative byte budget
DestroyClears registered entries before releasing the synchronization state
ReserveReserves bytes and returns a positive token, evicting global LRU entries when possible or returning zero when the entry cannot fit
TouchMoves an existing token to the newest position
ReleaseRemoves accounting for a token without invoking its eviction callback
SetPinnedProtects or unprotects an in-use entry and trims after unpinning
ClearRemoves all tokens and asks every participant to release its retained entry
ContainsTests whether a token remains registered
UsageForKindReturns retained bytes for one TPdfCacheKind
EntryCountForKindReturns the registered entry count for one TPdfCacheKind
StatisticsReturns a lock-protected telemetry snapshot
MaxBytesReads or changes the total budget and immediately trims unpinned entries after a reduction

Ownership and callback contract

The governor never owns participants or their retained data

Every participant must outlive all of its registered tokens and must not raise from EvictCacheEntry

Callbacks run synchronously without the governor lock held, so participants may safely call Release for related tokens

Pinned entries may temporarily keep StoredBytes above a reduced MaxBytes value until the last user unpins them

PDFium boundary

FPDF_RENDER_LIMITEDIMAGECACHE remains available through reLimitCache and applies PDFium's fixed native per-page image-cache limit

PDFium exposes no public ABI for a configurable or queryable process-wide cache byte budget

The governor therefore measures PDFiumPas-owned retained objects and uses an explicit estimate for opaque parsed page scenes

See Also

TPdf cache governor, TPdfTileCache, ConfigureSystemFontCacheGovernor