-
public final class DiskCacheManagerDisk-based cache for rendered PDF tile bitmaps. Caches tiles to the app's cache directory for fast reopening of PDFs. Uses WebP format for 30-50% smaller file sizes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classDiskCacheManager.Companion
-
Constructor Summary
Constructors Constructor Description DiskCacheManager(Context context)
-
Method Summary
Modifier and Type Method Description final StringgetCacheKey(String documentHash, Integer page, RectF bounds, Float zoom)Generate a unique cache key for a tile. final BooleanhasTile(String cacheKey)Check if a tile exists in disk cache. final BitmaploadTile(String cacheKey)Load a tile from disk cache. final UnitsaveTile(String cacheKey, Bitmap bitmap)Save a tile to disk cache synchronously. final UnitsaveTileAsync(String cacheKey, Bitmap bitmap)Save a tile asynchronously to avoid blocking render thread. final UnitclearCache()Clear all cached tiles. final UnitclearDocument(String documentHash)Clear cache for a specific document. final LonggetCacheSize()Get current cache size in bytes. final Unitshutdown()Shutdown the executor when no longer needed. -
-
Constructor Detail
-
DiskCacheManager
DiskCacheManager(Context context)
-
-
Method Detail
-
getCacheKey
final String getCacheKey(String documentHash, Integer page, RectF bounds, Float zoom)
Generate a unique cache key for a tile.
- Parameters:
documentHash- Unique identifier for the document (e.g.page- Page indexbounds- Tile bounds (relative coordinates)zoom- Zoom level
-
saveTile
final Unit saveTile(String cacheKey, Bitmap bitmap)
Save a tile to disk cache synchronously.
-
saveTileAsync
final Unit saveTileAsync(String cacheKey, Bitmap bitmap)
Save a tile asynchronously to avoid blocking render thread. Creates a copy of the bitmap since original may be recycled.
-
clearCache
final Unit clearCache()
Clear all cached tiles.
-
clearDocument
final Unit clearDocument(String documentHash)
Clear cache for a specific document.
-
getCacheSize
final Long getCacheSize()
Get current cache size in bytes.
-
-
-
-