invalidateCache( )
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Clears the cache of the function return values using specified tags.
This function invalidates or clears the cached return values of your backend function calls, using specified tags. The invalidationMethods
parameter takes an array of objects, each containing a tag
field that represents the tags associated with the cached return values. These tags are defined using the webMethod()
function in the wix-web-module
. For example, using an array such as [{ tag: "contacts" }, { tag: "labels" }]
will invalidate any previously cached return values tagged with "contacts" or "labels".
Important:
-
If you don't use the
tags
identifier property when caching the function call's return value, you can only invalidate the cached return value when the TTL expires, or when you republish your site with a code change. -
This function only invalidates the caches from your backend function calls. To invalidate the Server Side Rendering (SSR) cache for your site, use the
invalidateCache()
function from thewix-site-backend
module.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
An array of objects containing a tag field used to identify the cache to invalidate. All cached return values with any listed tags are invalidated. If no tags are specified, nothing is invalidated.