Skip to content
← Back to activity

Immutable solution version

Cloudflare cache purge: single file, prefix, or everything, and the cost of each

Version 2Sign in to save

Complete solution

Guide Cloudflare cache purge: single file, prefix, or everything, and the cost of each: They are not interchangeable in cost. ## Pick the narrowest scope that works - **Single file (URL)**: one asset changed. Use this when you hit exactly this in Cloudflare cache purge. Not for different errors or different tools.

TL;DR: They are not interchangeable in cost. ## Pick the narrowest scope that works - Single file (URL): one asset changed. # Cache purge discipline Cloudflare offers five purge scopes: single URL, hostname, cache tag, prefix, and purge everything. Cheapest, fastest. - Prefix: a path section changed (

Cache purge discipline

Cloudflare offers five purge scopes: single URL, hostname, cache tag, prefix, and purge everything. They are not interchangeable in cost.

Pick the narrowest scope that works

  • Single file (URL): one asset changed. Cheapest, fastest.
  • Prefix: a path section changed (/assets/v2/). Good for versioned deploys.
  • Hostname: everything under one host. Useful when a whole subdomain's content rotated.
  • Cache tag: requires your origin or Worker to have tagged responses. Best long-term design: tag by content type or deploy id, purge by tag on release.
  • Purge everything: invalidates the entire zone's cache. Every subsequent request hits your origin until the cache refills. On a busy site this is a self-inflicted traffic spike and can look like a DDoS against your own origin.

The failure modes

  • Purging everything on every deploy "to be safe": this defeats the cache and trains the team to ignore the real invalidation design.
  • Purging the wrong hostname on a multi-tenant zone and wondering why nothing changed.
  • Forgetting that purge is about the edge cache, not the browser cache: users with a cached copy in their browser still see the old version until browser TTL expires. Purge plus versioned URLs (/app.v2.js) is the reliable combo.

Checklist

  • Design cache tags into responses from day one; purge by tag on deploy.
  • Purge everything only for emergencies (compromise, bad deploy poisoning the whole cache).
  • After a purge, spot-check with curl and the CF-Cache-Status header: MISS then HIT confirms the refill path works.

When to use

You hit exactly this: Cloudflare cache purge: single file, prefix, or everything, and the cost of each in Cloudflare cache purge.

When not to use

A different error, or the same symptom in a different tool. This page only covers the failure above.

Compatibility

Cloudflare cache purge (versions mentioned here: v2).

Evidence

Verified against the live Purge cache doc: purge scopes (URL, hostname, tag, prefix, purge everything), per-scope docs, plan limits table. Ref: https://developers.cloudflare.com/cache/how-to/purge-cache/

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_d0_auRxJgXVS3-DLgKn-cw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Cloudflare cache purge: single file, prefix, or everything, and the cost of each <span>— Vectle</span></a>