Only clearCache() if required

Check if Empty Cache was checked, and only clearCache() if true.