4

I am just curious to know if we can execute the page without cache, without flushing the actual cache like other framework do eg :

in Symfony if we add /app_dev.php in URL, it load the respective template without cache which help the developer to check live changes.

So is there any way in Magento 2 to load a page without cache eg: if we execute www.example.com/home?no_cache=1 ? Here no_cache=1 is just an example parameter. It will help the developer to check live changes on the page, because flushing the cache again and again is a time consuming and not a feasible way to flush cache on production mode. Sometime we have to make changes on production mode so it might be helpful to pass a param on url to execute the specific page without cache. How do I achieve this with Magento?

  • I asked the same question for Magento 1 three years back, which also applies to Magento 2: it's not possible. magento.stackexchange.com/questions/59462/… – MagExt Mar 29 '18 at 19:04
  • I was working examples of Alan Storm's MAgento 2 no frills layout and changes started live and then suddenly required flushing the cache with every edit. – Chris K Jul 9 at 21:01
0

There is no such thing i am afraid (within the url).

But what is the reason behind this? You do not need to flush the cache on a production environment.

If the reason why you ask this is because you do not want your customers to get slowed down then just 'refresh' the cache items that you need to refresh.

if you go to system >> Cache Management and there you just select the cache types that have a red status and then you press 'submit' while you have selected 'refresh' your cache is not deleted but refreshed.

This is the right way to use it when you change things like pages , blocks , configurations , etc etc

We never flush the cache on a live environment except during maintenance hours.

Next thing is that (this is not tested on my end) you can give your browser headers. In Magento you have the value

Cache-Control: no-store, no-cache, must-revalidate, max-age=0

Expires: -1

x-Cache: uncached

The X-cache is if you have Varnish if im not wrong Like i said i never tested this but maybe you can use something like Postman (https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop) in order too define these headers and request your page without cache.

Hope this was somehow helpful for you even though i need to dissapoint you on the url thing.

  • Thank you for explanation. This is what I already know. But sometime we have to make instant UI changes on live server (not staging server). So without flushing or refreshing the cache for respective page developer can check the change by passing the secret keyword on URL and bypass the cache. I just want to know how to achieve this? Because I know its working on some live Magento websites but not sure if they are using any extension or anything else. – Sanchit Gupta Mar 27 '18 at 4:27
  • Most developers like me (i own a development company) have a development environment where we develop new features or changes and test them. That is the best practice anyways because developing on a live website is not done for the obvious reasons... If a cache session expires your clients do see changes that you have implemented even though you do not want them too. That you can not control. If you do insist on doing so what you can do is use a Varnish server and exclude your IP from the caching or bypass the Varnish IP or use Postman as described – CompactCode Mar 27 '18 at 4:42
  • All the cache of the live websites that we use are being controlled by Varnish. So if the server has IP X.X.X.100 your Varnish IP might be X.X.X.105 . Regular users connect to the 105 while you can (for example with modification of the windows host fille) connect directly to X.X.X.100 . That is prob how they do it. support.rackspace.com/how-to/modify-your-hosts-file – CompactCode Mar 27 '18 at 4:44
  • Can you give me an example of what changes your are doing? – CompactCode Mar 27 '18 at 4:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.