Skip to content

Add element-level opt-out for page caching #3973

Description

@robinboening

Is your feature request related to a problem? Please describe.

Alchemy already supports disabling page caching per page layout with cache: false, but some pages may contain only one dynamic or permission-sensitive element while the rest of the layout should remain generally cacheable.

When such an element is present on a page, Alchemy should be able to skip page caching for that request, while still allowing the element partial to use its own fragment caching strategy.

I want to propose a new element definition option such as:

- name: restricted_downloads
  page_cache: false

Use case: an element renders different output depending on the current user’s permissions. If the whole page is considered fresh, the element partial is never executed, so its own fragment cache key cannot take effect. An element-level page-cache opt-out solves this without disabling page caching for all pages with that page layout.

I have been testing the described patch on a production server and its been working well for me. Would you accept a PR if I'd sent this upstream?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions