Skip to main content
Share Your Experience: Take the 2024 Developer Survey
7 votes
Accepted

How to set page cache expires to 7 days?

At present I see the expires is set to -1 The Expires header you see is client-side. Browsers should not cache things like product pages, etc. which is why the default Magento VCL sets it to -1 in ...
Danila Vershinin's user avatar
7 votes
Accepted

Edge Side Includes (ESI) in Magento 2

Magento uses ESI to isolate navigation block from other content. The main effect of ESI is separate TTL for part of the page. However, Magento uses the isolation effect of ESI in order to minimize the ...
Andrey Konosov's user avatar
4 votes
Accepted

How to prevent browser caching for merged files?

You can Enable the Sign static files option in system configuration and redeploy static files : Store=>Configuration=>Advanced=>Developer=>Static file signing settings to yes Make sure ...
Franck Garnier's user avatar
3 votes

Disable page cache for a single block

You can't disable single block cache like in magento 1, Magento recommends handling customer related data via ajax. So you need to create an api endpoint or section data and use javascript to ...
Gosu Przmak's user avatar
3 votes

Magento2: Home page caching issue

First of all, avoiding using Object Manager directly in our template. This is not good for best practice. Should create a new block and try to apply the solutions below: Solutions for Caching issue ...
Khoa TruongDinh's user avatar
3 votes
Accepted

Pressing "Flush magento cache" button in admin panel leads to "Currently unable to handle this request"

There can be different reasons for this issue. The best way to figure out the issue is "check your webserver log" which will be "/var/logs/[apache or nginx]/[the log file name configured in virtual ...
Nidheesh's user avatar
  • 1,048
2 votes
Accepted

How to completely disable cache for development?

Magento 1.9 doesn't have such a rigerous caching mechanism by default as Magento 2 does, so you should be able to load the new JS file by just clearing the cache from the backend or by disabling it ...
Lez's user avatar
  • 2,917
2 votes

How to interact with APCu?

APCu is basically a stripped down version of APC that only includes the data caching code, and is designed to work in tandem with OpCache if you need data caching. There is no as such implementation ...
Vivek Kumar's user avatar
  • 5,395
2 votes
Accepted

Magento 2 How to create cache for a collection inside controller

Please try the following code: use Magento\Framework\App\Action\Context; use Magento\Framework\App\CacheInterface; use Psr\Log\LoggerInterface; class Search extends \Magento\Framework\App\Action\...
Tokey Tu's user avatar
  • 394
1 vote
Accepted

How to store value to cache and update it once a day

I'd choose a slightly different setup which will make the solution easier. store your value as a config value in core_config_data using Magento\Framework\App\Config\Storage\WriterInterface define a ...
simonthesorcerer's user avatar
1 vote

How to interact with APCu?

Here is the final order of commands that worked for me: bin/magento setup:upgrade composer install --no-dev bin/magento setup:di:compile composer dump-autoload -o --apcu bin/magento setup:static-...
Kalvin Klien's user avatar
1 vote
Accepted

Make specific page in magento as not cacheable

You can use the below code to achieve it using XML. <block class="Magento\Framework\View\Element\Template" name="test_view" template="Magento_Theme::html/test.phtml"/> To make the page non-...
Technocracker's user avatar
1 vote

How to completely disable cache for development?

Even with all caches disabled, Magento will still cache locale & PDO connections which is a by-product of Zend framework which you can see in lib/. However there should be no blocks/html/etc. ...
B00MER's user avatar
  • 8,307
1 vote

How to completely disable cache for development?

My bet is Magento is not guilty here Static files are cached by default by most modern browsers (you should play with configuration of the browser you use & see if you can disable that feature, ...
Raul Sanchez's user avatar
  • 3,125
1 vote
Accepted

Refreshing cache is necessary to see the results of a controller action (delete)

You need to setup following step in your controller. 1. Define constructor – pass Magento\Framework\App\Cache\TypeListInterface and Magento\Framework\App\Cache\Frontend\Pool to your file’s constructor ...
Magento2 Devloper's user avatar
1 vote

Magento 2: How to disable caching for the header block?

The customer specific data(private data) is not a part of the public content, so there is no need to disable caching using cacheable attribute. Regarding the issue, the proper section of ...
Andrey Konosov's user avatar
1 vote

How to prevent browser caching for merged files?

Enable Sign static files option in system configuration and redeploy static files.
KAndy's user avatar
  • 20.9k
1 vote

Disable page cache for a single block

There are some ways to do this task : use cacheable="false" but it's not recommended because it will disable full page cache so it's bad for performance 2 try this protected function _construct(...
ThuanDoan's user avatar
1 vote

Cache Management

Flush Magento Cache This button deals with the main cache items for page display purposes. It can safely be used if you want to refresh your page. "Flush Magento Cache" removes only those ...
Rohit Kundale's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible