Caution: This post was published in 2019 and may contain information, techniques, or code examples that are no longer current. Please double-check official documentation and modern best practices before using anything from this article.

Magento Code: Magento 2 Cache Refresh Script

This is a stand alone script which can be called to refresh the cache in Magento 2

The script hooks into Bootstrap to generate a unique instance without needing to hook into Magento itself. The System will loop through all the cache types specified on line 13. If you have any custom modules that also require a cache, add it into this list.

My Magento Expertise

If you are planning a new e‑commerce store, considering a platform upgrade or looking for ongoing Magento support, I can provide the expertise you need. Based in Northern Ireland and working with clients locally and internationally, I deliver solutions that help businesses grow.

Contact me to discuss your Magento project