Skip to content

Magento 2 / Clear cache from another server

We have the project on 2 servers. Is there a way to programmatically clear cache for both servers?

I tried apply clear cache on 2 servers with this method but it does not work

And change event with catalog_product_save_after I tried modifying a field in some products, but the changes are only reflected in 1 server.

I have seen solutions such as creating a file in the root and placing the cache cleaning functionality to run from a url, or running a cron every so often to run the cache cleaning for the other server. I would like to know if there is a way to clear cache towards the other server programmatically?