Automate has this as a native flow action, and i'm actually surprised that I haven't seen this implemented natively in macrodroid. It does require root and it's actually something i use since macrodroid doesn't support it. To use this, create a flow in Automate linking the beginning block and the "clear app cache" block specifying the app package's cache you wish to clear and use it as a shortcut in macrodroid. You can also use this same general method to link other automation apps together for a really powerful galaxy of automation options beyond just using macrodroid.