class-cdn-purger.php

CDN cache purger (Cloudflare / Varnish).

Source includes/Edge/class-cdn-purger.php2 min readPart of Performance Optimisation

includes/Edge/class-cdn-purger.php

CDN cache purger (Cloudflare / Varnish).

Namespace: PerformanceOptimise\\Inc · Lines: 262

Class CDN_Purger

Purges third-party caches after the plugin\’s own cache is cleared.

Source: includes/Edge/class-cdn-purger.php, line 26

class CDN_Purger

Tags: @since 2.0.0

Constants

ConstantVisibilityValueLine
TOKEN_CONSTANTpublic\'WPPO_CLOUDFLARE_API_TOKEN\'35

publicstatic purge_all()

public static function purge_all(string=\'all\' $type, =null $url_path): bool

Purge the configured third-party cache.

ParameterTypeDefaultDescription
$typestring=\'all\'—Clear type (\’all\’ or \’single_page\’).
$url_path=null—Page path for single-page clears (unused; edge purges are all-or-nothing).

Return: bool — True when no purge was needed or all requests succeeded.

Tags: @since 2.0.0 The $type and $url_path parameters were added.

Source: includes/Edge/class-cdn-purger.php, line 56

privatestatic purge_litespeed()

private static function purge_litespeed(string $type, =null $url_path): void

Purge LiteSpeed/LSCache when purgeSync is enabled with stale handling.

ParameterTypeDefaultDescription
$typestring—Clear type (\’all\’ or \’single_page\’).
$url_path=null—Page path for single-page clears.

Return: void.

Tags: @since 2.0.0

Source: includes/Edge/class-cdn-purger.php, line 94

publicstatic is_configured()

public static function is_configured(): bool

Whether the configured purge service has everything it needs.

Return: bool.

Source: includes/Edge/class-cdn-purger.php, line 145

privatestatic purge_cloudflare()

private static function purge_cloudflare(array $cache): bool

Purge everything on Cloudflare for the configured zone.

ParameterTypeDefaultDescription
$cachearray—cache_settings values.

Return: bool.

Source: includes/Edge/class-cdn-purger.php, line 168

privatestatic purge_varnish()

private static function purge_varnish(array $cache): bool

Send PURGE requests to the configured Varnish endpoints.

ParameterTypeDefaultDescription
$cachearray—cache_settings values.

Return: bool.

Source: includes/Edge/class-cdn-purger.php, line 195

privatestatic log_failure()

private static function log_failure(string $service, string $detail): void

Surface a failed edge-cache purge through the plugin\’s debug log.

ParameterTypeDefaultDescription
$servicestring—Provider name.
$detailstring—Endpoint / reason.

Return: void.

Source: includes/Edge/class-cdn-purger.php, line 258

Hooks

Hooks referenced in includes/Edge/class-cdn-purger.php:

HookTypeLineNotes
wppo_varnish_purge_max_urlsfilter201—