Please follow below steps to disable cache for block :
– layout cache disable:-
1) You can use cacheable=”false” attribute in your layout to disable cache for a block but problem is that it will disable whole page cache.
1 |
<block class="QaisarSatti\HelloWorld\Block\HelloWorld" name="helloworld" cacheable="false" /> |
2) Another option for cache diable
1 |
<block class="QaisarSatti\HelloWorld\Block\HelloWorld" name="helloworld" ttl="30" /> |
– programmatically cache disable :
Disable cache for block programmatically:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<?php /** * Simple Hello World Module * * @category QaisarSatti * @package QaisarSatti_HelloWorld * @author Muhammad Qaisar Satti * @Email qaisarssatti@gmail.com * */ namespace QaisarSatti\HelloWorld\Block; class HelloWorld extends \Magento\Framework\View\Element\Template { public function getCacheLifetime() { return null; } } |
If you want get query string params in controller file,...
Create di.xml and add the below code Magemonkey/Redirect/etc/frontend/di.xml [crayon-62845f4aea428993672854/] Create...
You can try below code to change local date to...
Step 1: First you need to add registration.php file in...
Step1 : Override message.js in current theme file on the...