class-edge-purger.php

Edge cache purger — Cloudflare + Bunny.

Source includes/Edge/class-edge-purger.php3 min readPart of Performance Optimisation

includes/Edge/class-edge-purger.php

Edge cache purger — Cloudflare + Bunny.

Namespace: PerformanceOptimise\\Inc · Lines: 333

Class Edge_Purger

Edge cache purger.

Source: includes/Edge/class-edge-purger.php, line 24

class Edge_Purger

Tags: @since 2.0.0

Constants

ConstantVisibilityValueLine
PURGE_LOCKprivate\'wppo_edge_purge_lock\'32
PURGE_LOCK_TTLprivate6040

publicstatic get_purge_lock_key()

public static function get_purge_lock_key(): string

Get blog-prefixed lock key.

Return: string.

Tags: @since 2.0.0

Source: includes/Edge/class-edge-purger.php, line 48

publicstatic has_purge_lock()

public static function has_purge_lock(): bool

Whether lock is active.

Return: bool.

Tags: @since 2.0.0

Source: includes/Edge/class-edge-purger.php, line 58

publicstatic set_purge_lock()

public static function set_purge_lock(): void

Set lock.

Return: void.

Tags: @since 2.0.0

Source: includes/Edge/class-edge-purger.php, line 68

publicstatic purge_all()

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

Purge edge caches (Cloudflare and Bunny) after wppo_after_cache_clear.

ParameterTypeDefaultDescription
$type=\'all\'—Clear type (\’all\’ or \’single_page\’).
$url_path=null—Page path (or absolute URL) for single-page clears. Both params are deliberately untyped: this method runs as a WP hook callback (wppo_after_cache_clear via Cache::clear_cache(), untyped) and must stay tolerant of non-string payloads instead of throwing a TypeError.

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

Tags: @since 2.0.0

Source: includes/Edge/class-edge-purger.php, line 95

privatestatic resolve_page_url()

private static function resolve_page_url($url_path): string

Resolve a single-page purge target to an absolute URL.

ParameterTypeDefaultDescription
$url_pathmixed—Page path or absolute URL.

Return: string — Absolute URL or \’\’.

Tags: @since 2.0.0

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

privatestatic purge_cloudflare_files()

private static function purge_cloudflare_files(string $zone, string $token, string $url): bool

Purge specific Cloudflare files (URL-scoped single-page purge).

ParameterTypeDefaultDescription
$zonestring—Zone ID.
$tokenstring—API token.
$urlstring—Absolute URL to purge.

Return: bool.

Tags: @since 2.0.0 · @since 2.2.0 Delegates to Cloudflare_Purger::purge_files().

Source: includes/Edge/class-edge-purger.php, line 201

privatestatic purge_cloudflare()

private static function purge_cloudflare(string $zone, string $token): bool

Purge Cloudflare zone cache (purge_everything).

ParameterTypeDefaultDescription
$zonestring—Zone ID.
$tokenstring—API token.

Return: bool.

Tags: @since 2.0.0 · @since 2.2.0 Delegates to Cloudflare_Purger::purge().

Source: includes/Edge/class-edge-purger.php, line 230

privatestatic purge_bunny()

private static function purge_bunny(string $zone, string $api_key): bool

Purge Bunny pull zone cache.

ParameterTypeDefaultDescription
$zonestring—Pull zone ID.
$api_keystring—API key.

Return: bool.

Tags: @since 2.0.0

Source: includes/Edge/class-edge-purger.php, line 257

privatestatic log_failure()

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

Surface failure via debug log.

ParameterTypeDefaultDescription
$servicestring—Service.
$detailstring—Detail.

Return: void.

Tags: @since 2.0.0

Source: includes/Edge/class-edge-purger.php, line 289

privatestatic mirror_to_activity_log()

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

Mirror a failure to the activity log when no debug-log listener exists.

ParameterTypeDefaultDescription
$servicestring—Service.
$detailstring—Detail.

Return: void.

Tags: @since 2.2.0

Source: includes/Edge/class-edge-purger.php, line 311

Hooks

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

HookTypeLineNotes
wppo_debug_logaction290@param ×2