magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.48k stars 9.29k forks source link

Centralised management for non cacheable pages #33272

Open Den4ik opened 3 years ago

Den4ik commented 3 years ago

Description (*)

Currently we have one easy way for disabling full page cache for specific pages that is to set cacheable="false" for some block in layout. Layouts could get updates from other files by handles and it's take a time for checking all files.

I suggest add new one xml file that will contain actions that should be not cacheable. It should be something like sections.xml.

<config>
    <action name="customer/account/*"/>
    <action name="checkout/*/*"/>
</config>

Expected behavior (*)

Easy manage for uncachable page list.

Benefits

All actions for uncachable pages will be provided in one file. It will save developers time.

m2-assistant[bot] commented 3 years ago

Hi @Den4ik. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

Den4ik commented 3 years ago

cc: @ihor-sviziev @gabrieldagama @sidolov @sivaschenko

What do you think guys?

Den4ik commented 3 years ago

Another one point or bug. cacheable="false" affect to fpc only but not to block_html cache. In my opinion if I set cacheable="false" then block should not be cacheable independently do we have cache_lifetime argument.

Try to test

<block name="some.block" template="{some_template.phtml}" cacheable="false">
    <arguments>
        <argument name="cache_lifetime" xsi:type="number">86100</argument>
    </arguments>
</block>

FPC will be disable, block html will be cached. It is little bit confuse.

ihor-sviziev commented 3 years ago

Let's ask @maghamed about that. What do you think?

As to me - what we have right now is good enough. Tbh Magento already has a complex caching mechanism, and adding configuration for it in one more place is not what we should do.

Den4ik commented 3 years ago

Main idea is to have ability manage config from one place. instead of pasting it into multiple layout files.