class-edge-cache.php

Edge HTML Cache Adapter — Cloudflare Workers / Bunny Edge.

Source includes/Edge/class-edge-cache.php2 min readPart of Performance Optimisation

includes/Edge/class-edge-cache.php

Edge HTML Cache Adapter — Cloudflare Workers / Bunny Edge.

Namespace: PerformanceOptimise\\Inc · Lines: 323

Class Edge_Cache

Edge cache adapter.

Source: includes/Edge/class-edge-cache.php, line 30

class Edge_Cache

Tags: @since 2.0.0

Constants

ConstantVisibilityValueLine
FILTER_ENABLEDpublic\'wppo_edge_cache_enabled\'38
FILTER_WORKER_CONTENTpublic\'wppo_edge_cache_worker_content\'46
FILTER_WRANGLER_CONTENTpublic\'wppo_edge_cache_wrangler_content\'54
FILTER_BUNNY_CONTENTpublic\'wppo_edge_cache_bunny_content\'62
TEMPLATE_MAX_BYTESprivate1048576166

publicstatic is_enabled()

public static function is_enabled(): bool

Whether edge cache is enabled.

Return: bool — True when edge cache is enabled.

Tags: @since 2.0.0

Source: includes/Edge/class-edge-cache.php, line 73

publicstatic is_configured()

public static function is_configured(): bool

Whether edge purge has valid configuration.

Return: bool.

Tags: @since 2.0.0

Source: includes/Edge/class-edge-cache.php, line 98

publicstatic get_config()

public static function get_config(): array

Get adapter config for template generation.

Return: array{origin_url:string, — cache_ttl:int, swr:int, provider:string}.

Tags: @since 2.0.0

Source: includes/Edge/class-edge-cache.php, line 124

privatestatic read_capped_template()

private static function read_capped_template(string $filename): string

Read an edge template file with a size bound.

ParameterTypeDefaultDescription
$filenamestring—Template file name under templates/.

Return: string — File contents, or \’\’ when unusable.

Tags: @since 2.2.0

Source: includes/Edge/class-edge-cache.php, line 181

publicstatic get_worker_js()

public static function get_worker_js(array=array() $config): string

Get Cloudflare Worker JS content.

ParameterTypeDefaultDescription
$configarray=array()—Optional override config.

Return: string — Worker JS source.

Tags: @since 2.0.0

Source: includes/Edge/class-edge-cache.php, line 213

publicstatic get_wrangler_toml()

public static function get_wrangler_toml(array=array() $config): string

Get wrangler.toml content for Cloudflare Workers deployment.

ParameterTypeDefaultDescription
$configarray=array()—Optional override config.

Return: string — wrangler.toml source.

Tags: @since 2.0.0

Source: includes/Edge/class-edge-cache.php, line 252

publicstatic get_bunny_edge_js()

public static function get_bunny_edge_js(array=array() $config): string

Get Bunny Edge JS content (Edge Rules / pull zone adapter).

ParameterTypeDefaultDescription
$configarray=array()—Optional override config.

Return: string — Bunny edge JS source.

Tags: @since 2.0.0

Source: includes/Edge/class-edge-cache.php, line 292

Hooks

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

HookTypeLineNotes
wppo_edge_cache_configfilter143@param ×1