Hello, I'm wondering if it is possible to use the Authcache P13N's "assembly" technique within modules that otherwise the "fragment" technique. I have an implementation of Authcache Panels Page Manager. There are multiple panes in the layout that use Authcache. Each pane is retrieved with a separate HTTP request. I'd prefer they were all retrieved with one request instead of separate requests.
Could I achieve this end with either a custom module that I would write or a patch to authcache_panels and/or authcache_panels_page_manager? If it were a patch I think it would need to involve at least these parts:
1. A implementation of hook_authcache_p13n_assembly(). Currently authcache_panels_page_manager implements hook_authcache_p13n_fragment() instead.
2. There would need to be a mechanism for each authcache-enabled pane to be declared as something for the assembly hook or the fragment hook. I imagine there could be a setting on the cache plugin form in authcache_panels.
3. To bridge the pane settings and the info hooks _authcache_panels_page_manager_collect_fragments_from_handlers() would need to know about the difference between assembly and fragments. There might then be a change to authcache_panels_pane_fragment() as well.
4. authcache_panels_panels_pane_content_alter() might need to change in some way too.
Does that seem like a reasonable plan?
Comments
Comment #1
znerol commentedSorry for my late response.
At some point I thought about aggregating all CSRF tokens of a page into one assembly. But then again it very much depends on your use-case. It is important to understand that fragments responses are stored in the browser cache. So if a fragment can be reused on multiple pages, then it might be better to not bundle it with other / unrelated fragments.
Also fragments do not require any JavaScript on the client side if they are delivered via ESI while assemblies always require client-side scripting.
If I were to implement that, I'd probably start out with a custom module. Implement
hook_authcache_p13n_assembly()andhook_panels_pane_content_alterand hard-code the configuration there.Note that you can inspect the configuration structure of fragments, assemblies and settings in Home » Administration » Configuration » System » Authcache » Personalization » Frontcontroller, then click on the
Detailslink of the route in question.Comment #2
stevectorThanks! I'll give the custom module a shot.