What does "Clear cache and deploy site" do specifically?

Hi all,

I was wondering what specifically does the “Clear cache and deploy site” function specifically do in the “Deployment” section? What is the difference between using that and a regular deploy?

Something I noticed is that in the “Overview” section, the preview image that shows up is a default blank smiling face but if I use “Clear cache and deploy site,” the preview image actually shows an image of the site.

Hi, @yangci, and welcome to our Netlify community site. :+1:

There is a cache directory the build system uses at Netlify to speed up the site build when possible. This is a cache of the various things which include for example the node_modules directory and the repo itself for the site. This makes the next checkout of the repo and the updating of the node dependencies faster in most cases.

However, sometimes changes occur to these directory between builds which cause builds to fail when the cached version is used. This button (“Clear cache and deploy site”) causes that cache directory to be deleted so a fresh git clone and npm install occur without loading the cached version.

Regarding the preview image, this isn’t related to that button. The preview should update whenever there is a successful build of a site.

There was a time where the preview wasn’t updating at all. So sites without a recent build may not have a preview (if they were last built when this preview wasn’t working).

If there are other questions, please let us know.