Outdated Render Cache

PSPDFKit uses an internal render cache for speeding up page access times. Whether you are using the PdfFragment or PdfActivity, or you render pages manually using a PdfDocument, pages will be served from the internal cache, if available. PSPDFKit will keep track of changes to the document and will invalidate the render cache if necessary.

What causes the cache to become stale?

While PSPDFKit tries to detect changes to a document to avoid a stale cache, there are a set of scenarios in which you have to manually tell PSPDFKit to invalidate its caches. In most situations, an outdated or stale render cache will cause page display issues, such as flickering of the displayed page, or wrong thumbnail images in the thumbnail bar.

Typical operations that will cause an outdated render cache include:

  • External changes to a previously opened PDF document, for example adding annotations to it.
  • Externally replacing a PDF document while keeping most of the original data untouched, for example restoring an older version of the PDF.
  • Deactivating auto-save and manually saving the PdfDocument instance.

Manual cache invalidation

You can invalidate the cache, forcing a re-rendering of pages by using one of the following methods.