I don’t recommend this method. It always rebuild shader everytime when you open the project. There is no point of “cache” when you do this.
Edit: I found the solution.
Go to Epic Games\UE_4.27\Engine\Config and open BaseEngine.ini
CTRL+F and search for [InstalledDerivedDataBackendGraph] then change the Path in the screenshot below.
Video Tutorial: