invalidateCache( )


Invalidates the cache for a site.

Calling the invalidateCache() function submits a request to invalidate (clear) the site cache. The function returns a Promise that resolves when the invalidation request is accepted (or rejected). Note that the invalidation process normally takes a few seconds to propagate.

Most Wix sites are cached by default to provide better performance. In cases where your site changes without publishing, caching may adversely affect your site. For example, if your site fetches and displays data from a 3rd-party service, you might experience the following issues on a cached site:

  • Updated data is not displayed.
  • Updated data is not exposed to bots, hurting SEO.

Note: This function only invalidates the cache for your site. To invalidate the caches from your backend function calls, use the invalidateCache() function in the wix-cache-backend module.

You can prevent such issues by invalidating your site's cache following a data update.

Method Declaration
Copy
Request
This method does not take any parameters
Was this helpful?
Yes
No