xSpeed Cache is officially live! Get 50% OFF during Launch Week — Lifetime starts at just $79Lifetime from $79 — 50% OFF, Launch Week! See Plans →

See Plans →
Features
xSpeed Hub Pricing Docs Blog Scan
Appearance
Get Plugin

Purge the WordPress cache with Gemini CLI

Purging the WordPress cache with Gemini CLI means asking it, in the terminal you deploy from, to clear the xSpeed cache on the site you just changed through the xSpeed Hub server added to Gemini CLI.

list_sitesget_cache_statuspurge_cachepurge_cloudflarestart_preloader

Last updated: October 2026

Example session · Gemini CLI

You: Pushed the new stylesheet to blog. Use xSpeed Hub to purge what is stale and warm it.

list_sites read-only
→ 6 sites; blog is blog.example.com

Gemini CLI: Only CSS changed, so I will purge assets on blog and then start the preloader. Go ahead?

You: Yes.

purge_cache(site: blog, type: assets) changes site
→ 27 minified CSS and JS files cleared

start_preloader(site: blog) changes site
→ preloader started, 188 URLs queued

Gemini CLI: Assets on blog are cleared and 188 URLs are warming.

01

How Gemini CLI handles this

You are in a Gemini CLI session after a deploy. The site is serving a stale stylesheet, and you would rather not leave the terminal. You tell Gemini CLI the site and what changed, and it calls list_sites to match the name, then purge_cache with the right type, then start_preloader if you asked for a warm-up. Each call is printed in the session with its result.

What returns is the plugin's report: the type, the site, how many entries cleared, and for type all whether the object cache and a Cloudflare edge went too. If a site has Cloudflare connected, Gemini CLI can tell you in one line whether the edge accepted the purge. Because it is a terminal session, it chains easily with what you just ran: after the push, purge, then read get_cache_status and say whether the hit ratio is recovering.

Gemini CLI shows a confirmation before an MCP tool call unless the server entry sets trust to true or you started it with --approval-mode=yolo (or --yolo), which approves every tool call. The choices are to proceed once, always allow that tool, always allow the whole xspeedhub server, or cancel. That prompt is the main check on a purge, because xSpeed Hub itself runs a write as soon as the connection allows it. For a purge across every site, the Hub also tells Gemini CLI to say that it will touch all the sites and wait for your yes, but that is guidance to the model, not a lock.

02

Set up Gemini CLI once

Already connected? Skip to the prompts. Alternatives and troubleshooting are on the Gemini CLI guide.

1Put your sites in xSpeed Hub

Sign in at app.xspeedcache.com with Google or email; the Hub is free and has no site cap. Then connect each WordPress site from its own dashboard: click Connect Hub in the xSpeed Cache top bar, then Connect via xSpeed Hub. Each site needs the free xSpeed Cache plugin.

2Add xSpeed Hub to Gemini CLI

Run this once. --scope user writes the server to ~/.gemini/settings.json so it works in every project; without it Gemini CLI saves to the project's .gemini/settings.json, which is the default.

Terminal
gemini mcp add --scope user --transport http xspeedhub https://app.xspeedcache.com/xspeed/mcp

3Authenticate with /mcp auth

Start gemini and run /mcp auth xspeedhub. A browser page opens where you sign in to xSpeed Hub and approve access, and Gemini CLI receives the redirect on a local port. There is no token to paste, and the client keeps the credentials it receives. Run /mcp afterwards to check that xspeedhub shows as connected and lists its tools.

Text
/mcp auth xspeedhub
1 / 3

Full Gemini CLI setup, sign-in options and FAQ

Before you send a prompt that changes something

Reads change nothing on your sites, though contact_support emails xSpeed support. Writes run once your connection allows them, so your client's approval prompt and a read-only connection (the token's Read-only everywhere switch, or a Viewer sign-in) are the gates that matter. Gemini CLI shows a confirmation for an MCP tool call unless the server entry sets trust to true or you start Gemini CLI with --approval-mode=yolo (or --yolo), which approves every tool call. You can proceed once, always allow that tool, always allow the whole xspeedhub server, or cancel; the last two choices stop later prompts for those tools. Policy rules in ~/.gemini/policies can allow, deny or ask for a named tool by server and tool name. The Hub has no confirmation step of its own, so a trusted server, YOLO mode or an allow rule lets a write run as soon as your connection allows writes.

03

What do I ask?

Three prompts written for Gemini CLI. More for this job are below.

Prompt for Gemini CLI
I pushed a CSS change to blog. Use xSpeed Hub to purge only the assets cache there and say what was cleared.
Prompt for Gemini CLI
Using xSpeed Hub, purge the page cache on shop, start the preloader, and check the cache status when it finishes.
Prompt for Gemini CLI
With xSpeed Hub, purge every site in my workspace and give me the failures, if any.
04

What happens, step by step

A purge throws away stored copies so the next visitor gets a fresh page. Through xSpeed Hub an agent can purge everything, only pages, only CSS and JavaScript assets, the object cache or the REST cache, on one site or across every site in a workspace. A full purge also clears the Cloudflare edge when the site has Cloudflare connected.

01

Find the site

The agent calls list_sites when you have more than one site, then matches the name you used to a site handle. If the name could mean two sites, the Hub tells it to ask you rather than guess.

02

Pick the purge type

purge_cache takes a type: all, page, assets, object or rest. all clears the page cache, the object cache and, when they are connected, the Cloudflare edge and CDN. After a theme or CSS change, assets is enough; after a content edit, page; after a deploy, all.

03

Purge

The call runs straight away on that site once your connection allows writes. For every site at once the agent passes site: "all", and the Hub runs the sites one after another with a one-second pause.

04

Clear only the edge if that is all you need

purge_cloudflare empties the Cloudflare edge cache on its own, without touching the copies on your server. A page or assets purge does not reach Cloudflare; a purge of type all does when Cloudflare is connected.

05

Warm it again

start_preloader rebuilds the cache in the background so the first visitors after the purge are not the ones paying for it.

05

Reference

Toolpurge_cache (write)
Purge typesall, page, assets, object, rest
What all coversPage cache, object cache, plus the Cloudflare edge and CDN when connected
Every site at oncesite: "all" or a list of handles, one result per site
Fan-out pacingSites run one after another with a 1 second pause
Edge onlypurge_cloudflare, a separate write tool
Re-warmstart_preloader after the purge
Read-only accesspurge_cache is refused on a connection token with Read-only everywhere on, and for a Viewer sign-in
ConfirmationNone on the Hub; your client's prompt is the gate
06

Rules worth keeping

  • Name the site. With several sites, an unclear name should make the agent ask, and the Hub tells it to.
  • A purge of every site is one call with site: "all". The Hub tells the agent to confirm it with you once before it runs.
  • Purge the narrowest type that fixes the problem, then warm the cache, so visitors do not all hit uncached pages at once.
  • A fan-out result is reported per site. Treat some sites failing as a partial result, not a failure of the whole call.

Good to know with Gemini CLI

Marking the xspeedhub server as trusted in the settings tells Gemini CLI to skip its confirmations for that server, so every write, including a purge on every site, runs without stopping. Always allowing the whole server in a prompt has a similar effect for later calls, and starting Gemini CLI with --approval-mode=yolo (or --yolo) approves every tool call in the session. Leave it untrusted unless the session is one you are happy to leave alone, use a policy rule if you want a named tool allowed, denied or asked about, and use a connection token with Read-only everywhere on for sessions that should only inspect. Remember that the trust flag covers the whole server, not just the purge: update_settings and toggle_cache stop prompting too.

07

More prompts for this job

They work in any client connected to xSpeed Hub.

Prompt
Use xSpeed Hub to purge the page cache on blog.
Prompt
I just changed the theme CSS on shop. Use xSpeed Hub to purge only the assets cache there.
Prompt
With xSpeed Hub, purge every site in my workspace and tell me which ones failed.
Prompt
Use xSpeed Hub to purge shop, then purge its Cloudflare edge cache too.
Prompt
With xSpeed Hub, purge the docs site and start the preloader so it is warm again.
Prompt
Using xSpeed Hub, what purge type should I use after updating a plugin that changes the checkout page?
08

Frequently asked questions

Yes. With xSpeed Hub added as an MCP server in Gemini CLI, ask it in the same session to purge the site you deployed. It calls purge_cache with the type that fits and reports what was cleared.

Gemini CLI shows a confirmation for an MCP tool call unless the server entry sets trust to true, which bypasses every confirmation for that server, or you start it with --approval-mode=yolo (or --yolo), which approves every tool call. If you mark the xSpeed Hub server as trusted, its write tools, including purge_cache, run without that prompt, and xSpeed Hub has no confirmation of its own to catch them. Leave it untrusted, choose always allow only for read tools, or use a connection token with Read-only everywhere on.

all clears every cache xSpeed manages for the site, including a connected Cloudflare zone or CDN. page clears the stored HTML pages, assets clears minified and combined CSS and JavaScript, object clears the Redis or Memcached object cache, and rest clears cached REST API responses.

A purge of type all does, when the site has Cloudflare connected in xSpeed: it clears the page cache, the object cache and the Cloudflare edge, and reports each one. A page, assets or rest purge stays on your server. purge_cloudflare clears only the edge.

Yes. The agent passes site: "all" to purge_cache and the Hub purges every site in the workspace one after another, returning a result per site. The Hub tells the agent to confirm a write across every site with you once before it runs it.

The next request to each purged page builds it fresh, which is slower than a cached hit. Starting the preloader right after the purge rebuilds the cache in the background so visitors mostly land on warm pages.

09

Keep going

Purge the cache with other agents

More with Gemini CLI

Documentation

From the blog

Purge the cache, from Gemini CLI.

xSpeed Hub is free and has no site cap. Connect your sites once and ask from the agent you already use.