Caching

Page-level caching

Lupus Decoupled Drupal takes advantages of Drupal's built-in caching system based around cache metadata. Given that the following modules provided by Drupal core work as usual:

  • Internal Page Cache - Caches page for anonymous users, with cache-tag based invalidation.
  • Dynamic Page Cache - Cache pages for authenticated users, with cache-tag based invalidation.

Since all the caching related HTTP headers get set correctly, also CDN or reverse-proxy (e.g. varnish) based caching works as usual. Just like with traditionally rendered Drupal pages, the pages rendered with custom elements have cache metadata associated, thus things like cache-tag based invalidation are supported.

Next, the following Drupal extension modules are great, optional additions and fully supported:

  • Purge module - A general cache invalidation API, optionally with cache-tag based invalidation.
  • Varnish based cache and cache-tag invalidation via Varnish Purger
  • Modules adding further cache backends, like Redis
  • Various CDN modules, like Cloudflare

Render caching

Since pages rendered into custom elements are skipping the Drupal internal, traditional render system, the Drupal-internal render-caching is bypassed. Instead of caching individual rendered pieces, whole pages can be cached well via dynamic page cache. Since the LupusCeRenderer module attaches the per-user rendered local tasks (the Drupal tabs) via a Kernel response event that is triggered after the Dynamic Page Cache, the pages can be cached efficiently across user-roles if the page-content is not user or role dependent. Additionally, the page response includes only the main content (no menus etc.), so it's often cacheable.