Skip to content

Commit

Permalink
Do not use use cache by default
Browse files Browse the repository at this point in the history
Usually it's not needed, because each page shows different content
that will be cached with FPC. However, when used inside navigation dropdown,
we may cache the result to optimize page load.
  • Loading branch information
vovayatsyuk committed Jul 24, 2023
1 parent c3f982b commit dd91a93
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
6 changes: 1 addition & 5 deletions Block/SubcategoriesList.php
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,7 @@ public function getIdentities()

protected function getCacheLifetime()
{
if ($this->getData('cache_lifetime') === false) {
return null;
}

return parent::getCacheLifetime() ?: 3600;
return $this->getData('cache_lifetime') ?: null;
}

public function getCacheKeyInfo()
Expand Down
3 changes: 3 additions & 0 deletions etc/widget.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
<label translate="true">Custom Template</label>
<description translate="true">Used, when template value is set to 'Custom'</description>
</parameter>
<parameter name="cache_lifetime" xsi:type="text" visible="true" sort_order="107">
<label translate="true">Cache Lifetime (Seconds)</label>
</parameter>
<parameter name="hide_when_filter_is_used" xsi:type="select" required="false" visible="true" source_model="Magento\Config\Model\Config\Source\Yesno" sort_order="110">
<label translate="true">Hidden, when filter or pagination is used</label>
</parameter>
Expand Down
13 changes: 12 additions & 1 deletion view/adminhtml/ui_component/pagebuilder_easycatalogimg_form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,17 @@
</select>
</formElements>
</field>

<field name="cache_lifetime" sortOrder="180" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">page</item>
</item>
</argument>
<settings>
<dataScope>cache_lifetime</dataScope>
<dataType>text</dataType>
<label translate="false">Cache Lifetime (Seconds)</label>
</settings>
</field>
</fieldset>
</form>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dd91a93

Please sign in to comment.