Outdated Render Cache

PSPDFKit uses an internal render cache for speeding up page access times. When using the PSPDFKitView component, 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.

How Caching Works

In most situations, PSPDFKit uses an in-memory cache of page renderings. When using the cache (which is the default), PSPDFKit will generate a unique cache key for every page it renders. If, for a specific cache key, there’s already a rendered image inside the cache, it’s served directly without rerendering.

What Causes the Cache to Become Stale?

While PSPDFKit tries to detect changes to a document to avoid a stale cache, there’s 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:

  • Reusing the same URI or file path for loading different documents.

  • External changes to a previously opened PDF document — for example, adding annotations to it.

  • Externally replacing a PDF document — for example, restoring an older version of the PDF.

  • Deactivating auto save and manually saving the PDFDocument instance.


When performing any of the listed operations, PSPDFKit won’t be able to detect file changes. In these cases, a manual cache invalidation should be performed.

Manual Cache Invalidation

You can invalidate the cache, which forces a rerendering of pages, by using one of the following methods available on the PDFDocument instance: