client.cdn.purge
Purge specific URLs from the CDN cache.
Signature
class Client {
cdn: {
purge(urls: string[]): Promise<{ success: boolean; purgedUrls: string[] }>
}
}
Parameters
| Name | Type | Required | Notes |
|---|---|---|---|
| | yes | Array of CDN URLs to purge |
Examples
import { Client } from '@blueforge/client'
const bf = new Client({ apiKey: process.env.BF_API_KEY!, url: 'https://your-project.blueforge.dev' })
const { purgedUrls } = await bf.cdn.purge(['https://cdn.example.com/img/1.jpg'])
console.log('Purged:', purgedUrls)
Throws
| Error | Condition |
|---|---|
| API request failed |
| Network issue |
Pitfalls
- Propagation delay — purged URLs may serve stale content for up to 60s while the invalidation propagates through edge nodes
- Rate limit — restricted to 20 requests per minute; subsequent requests are rejected with a rate-limit error
- URL must be served by CDN — purging a URL that is not part of the CDN distribution is silently accepted but has no effect
See also
{auto-injected}
Tested against
{auto-injected}