If you wipe cache partition on HTC One M8 running Android 6.x Marshmallow, it completely removes cached data and may speed up your device and reduce lags. Well, to wipe cache partition on HTC One M8 with Marshmallow, do as follows:
1. Turn off your device and wait for 5 seconds to make sure your M8 is completely shut down.
2. Press and hold the Volume Down button, and while you are still pressing it, press the Power Button to get into the Bootloader (Release both Volume and Power buttons)
3. Now, use the Volume Down button to move between the options and stop at the Recovery option. Press the Power Button to open the Recovery mode.
4. Wait for a few seconds, and a picture of a phone with an exclamation mark on it should appear on the screen
5. Press and hold the Power Button, and while you are pressing it, press the Volume UP button to go to a new menu (Release the buttons)
6. In this menu, use the Volume Down button to select the Wipe Cache Partition option, and press the Power Button to select it
7. You are asked to confirm to wipe cache your One M8, and once you accept it, the entire Cache Partition will be Wiped.
8. Now you should see the Reboot System Now option. Press the Power button to select it, and you device will be rebooted after about 10-15 seconds to Normal Mode.
Note that, if you wipe cache partition on HTC One M8, no data will be lost and this process just removes the cached data and temporary files.