CorefinityCorefinityDocs
Open the Control PanelControl Panel
Varnish · 4 of 12

corestack_varnish_purge

Purge a site's Varnish cache.

Scope writeRuns as a taskNo secrets returnedCoreCluster
On this page

When to use it

Purge a Magento 2 row's Varnish cache after content changed outside a deployment: everything, by Magento cache tag, by address or by pattern. Prefer a tag or an address to everything, so the rest of the store stays cached. Deployments purge Varnish themselves, and Magento purges its own tags when products and categories are saved, so neither needs this tool.

Ten purges an hour for each site, counted across the Corefinity Control Panel, the API and MCP together. Magento's own purges, deployments and the "Purge Varnish first" step of corestack_site_cloudflare_purge are not counted. When Cloudflare also caches the site, purge Varnish first, then Cloudflare.

The call answers a task on the purge command; follow it with corestack_command_get. Varnish confirms each purge but gives no count of the pages removed, so the result reports what was sent and that it was confirmed: {mode, count, hosts, confirmed, seconds}.

Ask for it

Prompt
Using the Corefinity MCP server, call corestack_varnish_purge with site_id 4211, mode tags, tags ["cat_p_1180","cat_c_27"]. (Purge a site's Varnish cache.) Tell me what it returned.

Inputs

hoststring or null

With urls or patterns, one of the row's storefront hosts (corestack_site_storefront_domains_list), without a port. Absent or null purges every host of the row. An absolute address in urls names its own host. Up to 253 characters.

modestringRequired

all, tags, urls or patterns. Send the list that matches the mode and no other. all empties the whole cache, also files Magento does not tag (robots.txt, sitemaps, verification files).

alltagsurlspatterns
patternsarray of strings

With patterns. Regular expressions (PCRE2) on the stored path and query, each starting with /; Varnish anchors them at the start, so /gravel-bikes(/|\?|$) purges that category and everything under it. /, /.* and .* purge almost everything: use mode: all instead. Up to 5 items.

site_idintegerRequired

The row, a Magento 2 site or one of its environments. At least 1.

tagsarray of strings

With tags. Magento cache tags such as cat_p_1180 or cat_c_27: letters, digits and underscores, up to 64 characters each. Up to 50 items.

urlsarray of strings

With urls. A path (/gravel-bikes) or an absolute address on one of the row's own hosts (https://example.co.uk/gravel-bikes). Each is purged exactly, its query included; Varnish ignores tracking parameters (utm_*, gclid, fbclid and the like) and the order of the others, as it does when it stores pages. Up to 30 items.

A page that one of your nginx rules rewrote is stored under the rewritten address: purge it by tag or by pattern.

Example call

tools/call
{
  "name": "corestack_varnish_purge",
  "arguments": {
    "site_id": 4211,
    "mode": "tags",
    "tags": [
      "cat_p_1180",
      "cat_c_27"
    ]
  }
}

If it is refused

ReasonWhat to do
varnish_offVarnish is switched off on this row; Magento's built-in cache serves pages (flush it with corestack_function_run flush_cache). Switch Varnish on with corestack_varnish_set first.
varnish_not_offeredThe row is not a Magento 2 site.
invalid_tagsA tag is not a Magento cache tag; fields.tags and details.offenders name each one.
invalid_urlsAn address is not a path or an address on this row, is longer than 2048 bytes, or holds spaces, quotes or control characters; details.offenders names each one.
host_not_ownedhost, or an absolute address's host, is not one of this row's storefront hosts.
invalid_patternA pattern does not start with /, is longer than 256 bytes, holds spaces or quotes, or does not compile; the message carries the PCRE2 error and its offset.
invalid_argumentsNo mode, or a list that does not match the mode.
rate_limitedThe ten purges this hour are used; retry_after_seconds says when the next one is available. A purge Varnish never received does not count.
deletedThe site is deleted (in its grace period); restore it with corestack_site_restore_deleted first.
provisioningThe site is still being created; wait for corestack_site_provisioning_get to finish.
managed_elsewhereAnother control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
tenant_mismatchThe object does not exist or the token may not see it. Check the id.
scope_requiredThe token lacks a scope this call needs. Open the link in the answer to add it, then call again.
pin_refusedThe grant is limited to chosen clusters, sites or environments, and this call is outside them. Open the link in the answer to widen it.
temporarily_unavailableThe Control Panel could not answer just now. Nothing was started; try again shortly.
internal_errorSomething went wrong on our side. Quote the trace id to support.

The same task elsewhere

Was this helpful?
Open in ClaudeOpen in ChatGPT