TPDFlibViewerBitmapCache
Data types, viewer interaction, caching
Description
Least-recently-used bitmap cache that bounds the memory the viewer spends on rendered pages
Entries are keyed by page number plus a quantised zoom, so changing the zoom naturally retires stale renderings as the budget fills; the cache owns its bitmaps and frees them on eviction
A bitmap larger than the whole budget is still stored alone so the viewer can always show the current page
The class is pure code with no window dependency, which keeps it testable headlessly; the viewer exposes its instance through the Cache property and resizes the budget through SetCacheLimit
Declaration
TPDFlibViewerBitmapCache = classKey members
| Create | Builds the cache with a byte budget given by AMaxBytes |
|---|---|
| Get | Returns the cached bitmap and marks it most recently used, or Nil on a miss |
| Put | Stores a bitmap under a key and takes ownership; evicts least recently used entries until the budget holds |
| RemovePage | Drops every entry of one page across all zoom and rotation keys |
| Clear | Frees every cached bitmap |
| Count | Number of retained bitmaps |
| UsedBytes | Bytes currently held |
| MaxBytes | Memory budget in bytes, writable at runtime |