Hot answers tagged

3

Either u can manually delete folders or using this command rm -rf var/cache/ generated/code pub/static/frontend pub/static/adminhtml After that you need to run these commands again , else the css/styles in magento frot-end and back-end won't load php bin/magento setup:upgrade php bin/magento setup:static-content:deploy -f php bin/magento setup:di:compile ...


3

I had the same problem when upgrading from 2.3.5-p1 to 2.3.5-p2, even when the deployment included disabling the Magento_GoogleShoppingAds module in config.php. In my case the solution was to flush Redis cache right before the deployment.


2

A good solution here would be to fetch the block via AJAX. Mage2.tv has an excellent video guide on how to do this. I would definitely recommend watching the full video tutorial from Mage2tv, it will deal with this topic in depth. As already noted, adding cacheable="false" to any block on the page will prevent the entire page from being cached by the full ...


2

In Magento 2.4.1 there are two success.phtml templates: module-checkout/view/frontend/templates/success.phtml module-inventory-in-store-pickup-frontend/view/frontend/templates/success.phtml In my case, I had to override the second one in app/design/frontend/Vendor/Theme/Magento_InventoryInStorePickupFrontend/templates/success.phtml


2

The result of your curl command would help? If empty try adding -I. Solution from the comments: Add any or both of the mentioned headers in your curl. curl -X PURGE -H 'X-Magento-Tags-Pattern: .*' https://www.example.com/my/link You can find what magento sets by eg. varnishlog | grep -i tags


2

Save "Home" page one more time and it will reset cache for this page. Or, if you want to do it programmatically, clear cache by tag $this->_cache->clean( \Zend_Cache::CLEANING_MODE_MATCHING_TAG, [\Magento\Cms\Model\Page::CACHE_TAG . '_' . $page->getId()] );


2

Actually this issue is related to Magento full page or block cache. But with fresh magento it should work properly so issue is related to custom module which used for customer login or session.


2

Is the price block automatically hole punched with Varnish for M2? No. there could be customer groups with different prices Magento uses X-Magento-Vary cookie to "tag" different versions of the same page. Then Varnish hashes response based on that cookie. This allows actually storing several full page cache versions for the same product (each, for ...


2

More information needed The curl request only displays the response. I'd like to see request information as well, to figure out which URL you called. The VCL file is truncated as well. It's not complete and I'm not 100% sure whether or not the Varnish headers are stripped through VCL. However it seems unlikely that these headers are stripped. Use Varnishlog ...


2

After reviewing your issue we have have come to the conclusion that the reason for the file not changing is down to cache. this is a common issue when using 3rd party caching platforms Suppliers Checked Fastly Varnish Redis Cloudflair


1

Ok, after some days of trying to understand what happened I gave up and just went for a workaround solution. Here is how I did it, hope it saves someone from days of dispear :) ! Create a mixin for the customer-data.js in the directory vendor\module\view\frontend\web\js\customer-data.js as follows: /** * Copyright © Magento, Inc. All rights reserved. * ...


1

The X-Magento-Cache-Debug header is set by Varnish VCL itself. From a standard VCL: sub vcl_deliver { if (resp.http.X-Magento-Debug) { if (resp.http.x-varnish ~ " ") { set resp.http.X-Magento-Cache-Debug = "HIT"; set resp.http.Grace = req.http.grace; } else { set resp.http.X-Magento-Cache-Debug = "MISS"...


1

You can implement the HTTP class and call the method setNoCacheHeaders, as you can see below. use Magento\Framework\App\Response\Http; public function myCustomMethod(){ $this->response->setNoCacheHeaders(); ... } It will implement this module below, which will set no-cache in the header.


1

Check this file vendor/magento/module-catalog/CustomerData/ProductsRenderInfoSection.php In this file, they are calling getList method which processing on product's data, And based on it Magento adding product_data_storage and for the price, Magento has used vendor/magento/module-catalog/Ui/DataProvider/Product/Listing/Collector/Price.php and vendor/magento/...


1

You can set disable browser cache in .htaccess file. See below code. After 1 or 2 days you can remove code so cache page again. <IfModule mod_headers.c> Header set Cache-Control "no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires 0 </IfModule> <FilesMatch "\.(css|flv|gif|...


1

I have found more info and directly linked with data changes (index therefore). The cache in Magento is built with tags. I will describe an example below that may show the product category listing can reflect the latest products' data without incurring huge costs on the server activity. Many blocks in Magento 2 do implement the interface \Magento\Framework\...


1

I answered a similar question about failing backends containing some debugging commands: How do I properly debug the root cause of 503 errors produced by Varnish? I always advise people to use varnishlog, because it contains valuable information about what's going on. I wrote an extensive blog post on how to use varnishlog: https://feryn.eu/blog/varnishlog-...


1

What you are observing is easily contributed by failed health probes in Varnish. The default is to consider the backend as sick if it takes 2 or more seconds to respond: backend default { .host = "/* {{ host }} */"; .port = "/* {{ port }} */"; .first_byte_timeout = 600s; .probe = { .url = "/pub/health_check....


1

yes theres a way to do this in observer: make a file called events.xml in etc folder: <?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="...


1

Not sure this is the problem, but since you say it's cache related, it could be the fact that the top links block is cached and the cache does not take into account the current url. So if you don't have a cache for it, and the first page you visit is the homepage it will always create the cache containing the homepage url. You can go around this by adding ...


1

Check this article it might help you http://www.jyotiranjan.in/blog/refresh-magento-cache-programmatically/


1

If we want to clear our example_id cache, we can either do it simply from the admin panel in Cache Storage Management and then refresh “Blocks HTML output” or do it programmatically using remove($cacheId) or clean(array($cacheTag)). Mage::app()->removeCache($id);


1

create your own cache type by declaring the following in your config.xml <global> <cache> <types> <custom translate="label,description" module="module"> <label>Custom Cache</label> <description>This is my custom cacge</description> ...


1

All the ones you mention are worth being looked at. I may have some more for you to take a look: in pub folder, it is useful to remove files that are not meant to be there and pub is often misused. Right away, find files that are larger than 5M is good place to start. They may be legitimate files. However, by doing just this, I once found an image that was ...


1

php bin/magento setup:static-content:deploy -f This should do it ! UPDATE: php bin/magento setup:upgrade php setup:di:compile php bin/magento setup:static-content:deploy -f php bin/magento indexer:reindex php bin/magento cache:clean php bin/magento cache:flush You should also be aware that due to Linux file permissions sometimes you need to give permission ...


1

Generally, we don't need to run every command all the time. Sometimes it only requires cache: flush but extension creation or enabling any extension needs every command. Not an issue if you're running these command unnecessarily except changing permission, but It's wasting of time, and mainly if the site is live, then it stops working until commands executed....


1

Use static content signing https://devdocs.magento.com/guides/v2.3/config-guide/cache/static-content-signing.html The version parameter ensures latest version If this is enabled it's a different issue. Perhaps a proxy cache has cached out of date page content. In which case you need to clear proxy cache after any deployment.


1

You can use the event clean_static_files_cache_after which gets dispatched after static files are cleaned. Create an observer and from there you can call your class.


1

this is not about operating system, this is only permissions. if your webserver/php user is nobody, then you better run all commands as nobody. https://linux.die.net/man/8/sudo su -c "Your command right here" -s /bin/bash nobody sudo su -c "Your command right here" -s /bin/bash nobody su nobody -s /bin/bash -c "Your command right here" -s /bin/bash ...


1

You need to remove these directories <magento_root>/var/cache/* <magento_root>/var/page_cache/* <magento_root>/generated/metadata/* <magento_root>/generated/code/* for more information please follow this link: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/cache/partial-caching/database-caching.html


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