cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 cache issue - changes are uploading with long delay

Magento 2 cache issue - changes are uploading with long delay

We have installed Magento 2.3 on our production server.

 

Whenever we do changes to css file or other Magento files it takes ages to reflect the page on the live website. The brutal method to get the changes to be visible on the live page is to deploy static content, sometimes it helped to clear the static content, but sometimes it the same doing didn't help, we have tried also to clear the preprocessed cache folder and all cache in the var folder, but it keeps regenerating with the old cache. 

 

We are now out of ideas on why it is behaving in this way.

 

We have got the stagging server where we do the same changes and they are applied straight away. 

 

Anyone would know why?

 

We don't have CDN and the server was checked.

 

4 REPLIES 4

Re: Magento 2 cache issue - changes are uploading with long delay

HI @aga_k,

Which deployment mode your are using on staging and on production?

php bin/magento deploy:mode:show

On the production mode we need to re-deploy if we do any changes.  

Re: Magento 2 cache issue - changes are uploading with long delay

Deploy mode is on both servers set as production mode

Re: Magento 2 cache issue - changes are uploading with long delay

Hello @aga_k ,

If any less/css file is already present in var/view_preprocessed or pub/static directory then your changes would not reflect in css because magento checks for those file in var/view_preprocessed or pub/static, if it was already there then magento didn't deploy that file again and if that file is not there then it deploy those files.

So firstly remove your static content by

rm -rf var/view_preprocessed/* rm -rf pub/static/frontend/* var/page_cache/* var/cache/* 

and then deploy the static content by 

bin/magento setup:static-content:deploy

If you have enable css merge the please remove your cache from pub/static/_cache/merged folder.

I hope this will work for you. If still you face same issue please let me know.

If it helps you, accept it as solution and give kudos.

Regards.

Re: Magento 2 cache issue - changes are uploading with long delay

Hi everyone. @aga_k , we have also been encountering such a problem on our production server, but seems we have finally found what causes it and how it can be solved, at least temporarily solved. So in our case it was opcache. Yes, php's cache is not flushed, and for some reason we can not flash it via CLI. But when fulfilling it via webserver all the recent changes to code become immediately applied. So if You are still facing the issue, please try to do the following.

Create somewhere in Your site's root directory a file lets say opcacheReset.php with the following content <?php opcache_reset() ?> so that it can be reached by https://{your.domain.com}/opcacheReset.php. Then simply navigate to that url. Then flush Your magento cache and check if changes are applied. Hope it will have worked in Your case too. Good Luck.