Clear configuration cache in SharePoint farm 2010 , 2013

There are many occasions where you need to clear configuration cache in SharePoint farm.

Here the steps you need to perform on all the servers in farm

1. Stop the SharePoint Timer service in all the servers.Start with the server running Central Administration website.
Start -> Services.msc -> SharePoint Timer Serviceclear configuration cache in sharepoint

2. Browse %SystemDrive%\ProgramData\Microsoft\SharePoint\Config\GUID (Works for windows server 2012 & 2008). Select the GUID folder with recently modified GUID folder.

Note: ProgramData folder is a hidden folder. Make sure that you enable to view hidden files.

3. Select all the XML files ONLY and delete.

4. DO NOT DELETE cache.ini file. This is really important and if you delete this file, it can screw up things in server. Be careful not to delete the cache.ini file

5. Open and edit the cache.ini file and set it to 1. It will have some random number like 39585, make it 1.

6. Start the SharePoint Timer Service.

7. Verify that XML files start repopulating the folder. It may take couple of seconds or even minutes.

8. Once XML files starts appearing back, repeat the steps 1 to 7 in all the servers to clear configuration cache in SharePoint farm.