---
title: "Cache Purging"
description: "Learn how to clear cached content from Edge CDN when you need to update or remove content."
url: https://edge.network/docs/cdn/purging/
---

# Cache Purging

Cache Purging

# 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:

Cached Objects
1,250

Number of items in cache

Total Cache Size
524 MB

Total bytes stored

Avg Object Size
419 KB

Average 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.

Screenshot: Cache Size section showing cached objects, total size, and average object size

## Purge Methods

### Purge by URL

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

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

### Purge by Path Prefix

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

```
/images/*
/assets/css/*
```

### Purge Everything

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

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 Console

- Navigate to your CDN deployment
- Click the **Purge Cache** button
- Select a purge method (URL, Path, or Everything)
- Enter the URL or path pattern (if applicable)
- Click **Purge**

Screenshot: Purge Cache modal with URL input field

## Purging via API

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

```
# 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
  }'
```

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

[Caching Learn about cache behavior](https://edge.network/docs/cdn/caching) [Analytics Monitor cache performance](https://edge.network/docs/cdn/analytics)
[Back to Docs](https://edge.network/docs) [Need help?](https://edge.network/support)
