PDFium Delphi Component Docs

ClearReadableContentCache method

Unit: PDFium
procedure ClearReadableContentCache;

Releases all retained readable snapshots and governor tokens, preserving cache limits and lifetime counters; returned caller snapshots remain valid

Shared readable-content cache

TPdf.ReadableContent, ReadablePageContent, DocumentReadableContent, their reading-unit helpers and a bound TPdfView.ReadableContent share per-page managed snapshots

A hit reuses the resolved fragments, including MCID text and geometry, without rebuilding the readable MCID map or opening a native text page

The default limits are 8 pages and 8 MiB of estimated retained managed data; pages use least-recently-used eviction and also participate in the document's total CacheBudgetBytes as pckReadableContent

Each result owns its fragment array, LineRects and MarkedContentIDs; caller changes cannot modify the retained snapshot

Notified content edits, structural changes, document-language changes, deactivation and replacement clear retained data; raw native mutations require the normal UpdatePage notification

Cross-page reads use transient native handles and preserve the document page, viewer page, native focus and pending edit buffer; cache entries retain no native handles

Oversized results, disabled retention, global-budget rejection and incomplete bounded structure traversal return the current full readable result without retaining it; native read failures propagate and are not cached

Readable reads reject during an active page-object edit transaction; call after commit or rollback

Limits account for conservative managed-data charges and do not bound parser/transient allocations, returned caller copies, whole-process memory or execution time

A working set larger than the configured capacity can evict earlier pages during a document scan; cache statistics report lifetime hits, misses, evictions and bypasses, including across clears

ReadableContentCacheCapacity, ReadableContentCacheMaxBytes, ReadableContentCacheStatistics, ClearReadableContentCache