Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache-identifier for content-nodes #7

Open
PRGfx opened this issue Dec 21, 2021 · 2 comments
Open

cache-identifier for content-nodes #7

PRGfx opened this issue Dec 21, 2021 · 2 comments

Comments

@PRGfx
Copy link
Contributor

PRGfx commented Dec 21, 2021

From my understanding, the content is only cached by the name of the @process configuration, so it is not really viable to use it for normal content-elements.

I could imagine a system of configuring a custom cache identifier, i.e. passing it down to the RenderPath prototype:

@process.ajaxify = Psmb.Ajaxify:Ajaxify {
  entryIdentifier {
    ...
  }
}

with some default values:

prototype(Psmb.Ajaxify:RenderPath) {
  @class = 'Psmb\\Ajaxify\\Fusion\\RenderPathImplementation'
  entryIdentifier = Neos.Neos:DataStructure {
    node = ${node}
  }
}

and the RenderPathImplementation building the entryIdentifier from the existing key and the (non-nullable, stringified) identifier parts.

Is this a sensible approach or am I missing something and this isn't even actually necessary?

@PRGfx
Copy link
Contributor Author

PRGfx commented Jan 14, 2022

I played around a bit with a more dynamic cache identifier and that works fine in itself, however I am now aware, that the rendering (root.ajaxify) does of course not know the content-nodes and I'm not sure how best to "recreate" a contex.
As this is all basically just a caching layer, I think the wording from the caching context would make sense (entryIdentifier, context). So maybe a Ajaxify component which serializes a context as the fusion runtime (or rather the ContentCache does). Unfortunately I don't see good ways to re-use any of this and I'm not sure rebuilding this behaviour makes sense at this point.

Any other ideas on how to achieve this?

If there is a node != documentNode, I could go for a more low-budget solution of storing that identifier and getting it from the document later, I think, but that feels like it will be limited with the next use-case.

PRGfx added a commit to mindscreen/Psmb.Ajaxify that referenced this issue Jan 19, 2022
* `Psmb.Ajaxify:Ajaxify` can configure the identifier for out-of-band
  rendered content with runtime values to discriminate by content-nodes
  and more.
* The URI builder receives an additional argument `contentNode` with the
  contextPath of the current content-node and hydrates it as context
  node `node` when rendering.
* The prototype implementations relax their hardcoded dependance on
  "Psmb.Ajaxify:Ajaxify" for ease of extensibility.

This change introduces `@apply` and `Neos.Fusion:Component`, so we break
support with neos/neos < 4.2.

While this addresses psmb#7, it doesn't further cachable context values that
might be required for other use-cases.
@PRGfx
Copy link
Contributor Author

PRGfx commented Jan 19, 2022

With 8811c03 I drafted a concept on how to handle dynamic cache-identifiers and how my approach could be used with content-nodes. However it does not satisfy my concerns regarding other rendering-relevant context variables: it only includes the content-node in the ajax request and exposes its contextPath doing so.
Because of that I won't open a PR for now, but will leave the fork as an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant