Skip to content
Docs

Clearing the cache

Instantly invalidate cached content across all edge nodes when you need to push updates.

When to purge

You might need to purge cached content when:

  • You've updated content at the origin and need to push changes immediately
  • You've deployed a new version of your site and need to clear old assets
  • You've found an error in cached content that needs to be corrected
  • You've removed content that should no longer be accessible

Cache size

Before purging, you can view the current cache size for your deployment. The Cache Size section shows real-time statistics about what's currently cached:

StatisticExampleMeaning
Cached Objects1,250Number of items in cache
Total Cache Size524 MBTotal bytes stored
Avg Object Size419 KBAverage size per object

These statistics are aggregated across all domains in your deployment and update in real time. After a purge, you'll see these numbers decrease as cached content is removed.

The Cache tab: cache size, purge by URL and purge everything
The Cache tab: cache size, purge by URL and purge everything

Purge methods

Purge by URL

Clear a specific file from the cache. Use this when you've updated individual files.

Output
https://cdn.yoursite.com/images/hero.jpg

Purge by path prefix

Clear all files under a specific path. Useful for clearing an entire directory.

Output
/images/*
/assets/css/*

Purge everything

Clear the entire cache for a domain. Use sparingly, as this temporarily increases origin load.

Warning

Purging everything causes all requests to go to your origin until the cache is repopulated. This can temporarily increase origin load and response times.

Purging via the console

  1. Navigate to your CDN deployment.
  2. Click the Purge Cache button.
  3. Select a purge method (URL, Path or Everything).
  4. Enter the URL or path pattern (if applicable).
  5. Click Purge.

Purging via the API

Integrate cache purging into your CI/CD pipeline using the Edge API.

Terminal
# Purge specific URLs
curl -X POST https://api.edge.network/v1/cdn/deployments/:id/purge \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": [
      "https://cdn.yoursite.com/images/hero.jpg",
      "https://cdn.yoursite.com/css/main.css"
    ]
  }'

# Purge by path prefix
curl -X POST https://api.edge.network/v1/cdn/deployments/:id/purge \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "paths": ["/images/*"]
  }'

# Purge everything
curl -X POST https://api.edge.network/v1/cdn/deployments/:id/purge \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "all": true
  }'

Note

Purge requests propagate to all edge nodes globally in under 200ms.

Purge speed

  • <200ms: global propagation
  • 100%: edge node coverage
  • Instant: effect on new requests

Best practices

  • Use versioned URLs: instead of purging, use versioned filenames (e.g. app.v1.2.3.js) and update references. This is more reliable and allows for instant rollback.
  • Be specific when purging: purge specific URLs or paths rather than everything. This maintains cache efficiency and reduces origin load.
  • Integrate with your deployment: add cache purging to your CI/CD pipeline so it happens automatically after deployments.

Next steps

Something unclear or out of date? Tell us, or read this page as Markdown.