springtimesoft/silverstripe-cloudflare-assets-purge
Composer 安装命令:
composer require springtimesoft/silverstripe-cloudflare-assets-purge
包简介
Queues a Cloudflare cache purge when Silverstripe assets are published, unpublished, or deleted
README 文档
README
Beta: This module is currently in beta for Silverstripe 5. A full release with Silverstripe 6 compatibility is planned.
Automatically purges the Cloudflare cache when Silverstripe assets are published, unpublished, or deleted, and after a dev/build.
Requirements
- Silverstripe ^5
- symbiote/silverstripe-queuedjobs ^5
Installation
composer require springtimesoft/silverstripe-cloudflare-assets-purge
Configuration
Add the following environment variables to your .env:
CLOUDFLARE_PURGE_ZONE_ID="your-zone-id"
CLOUDFLARE_PURGE_API_TOKEN="your-api-token"
The API token requires the Cache Purge permission on the target zone.
If either variable is absent the module silently does nothing, so it is safe to install in environments where Cloudflare is not configured (e.g. local development).
How it works
- File / Image publish - queues a full-zone cache purge via
FileCachePurgeExtension::onAfterPublish. - File / Image unpublish - queues a purge via
FileCachePurgeExtension::onAfterUnpublish. - File / Image delete - queues a purge only when a live version exists (draft-only files have nothing cached).
- dev/build - queues a purge via
DevBuildCachePurgeExtension::onAfterBuild.
Purges are handled asynchronously by PurgeWebsiteAssetsJob, which calls the Cloudflare Cache Purge API with purge_everything: true. This flushes the entire zone cache - not just assets - so pages, CSS, JS, and any other cached responses will also be invalidated.
License
MIT License. See LICENSE for details.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-14