includes/Cache/class-advanced-cache-handler.php
Advanced_Cache_Handler class for the PerformanceOptimise plugin.
Class Advanced_Cache_Handler
Class Advanced_Cache_Handler
class Advanced_Cache_HandlerConstants
| Constant | Visibility | Value | Line |
|---|---|---|---|
DROPIN_MARKER | public | \'WPPO_ADVANCED_CACHE_DROPIN\' | 32 |
publicstatic get_dropin_path()
public static function get_dropin_path(): stringPath to the advanced-cache.php drop-in.
Return: string.
privatestatic log_dropin_issue()
private static function log_dropin_issue(string $message): voidLog a drop-in inspection problem at most once per hour. Parameter Type Default Description $messagestring— Message to log.
Return: void.
publicstatic is_our_dropin()
public static function is_our_dropin(): boolWhether the existing advanced-cache.php (if any) was created by this plugin.
Return: bool — True when the drop-in exists and is WPPO-owned; false otherwise (including unknown).
publicstatic foreign_dropin_present()
public static function foreign_dropin_present(): boolAnother plugin (or host) owns advanced-cache.php; we must not replace it.
Return: bool.
publicstatic get_dropin_backup_path()
public static function get_dropin_backup_path(): stringPath to the backup copy of our drop-in kept alongside advanced-cache.php.
Return: string — Backup file path.
publicstatic normalize_dropin_host()
public static function normalize_dropin_host(string $raw_host): stringNormalize a raw host value the same way the generated drop-in does. Parameter Type Default Description $raw_hoststring— Raw host value (e.g. `$_SERVER[\’HTTP_HOST\’]`).
Return: string — Normalized lowercase host, or \’\’ when invalid.
publicstatic is_host_allowed()
public static function is_host_allowed(string $request_host, string $canonical_host): boolWhether a request host is allowed to read the static cache tree. Parameter Type Default Description $request_hoststring— Raw request host (e.g. `$_SERVER[\’HTTP_HOST\’]`). $canonical_hoststring— Baked canonical host.
Return: bool — True when the request may read the canonical cache tree.
publicstatic sanitize_host()
public static function sanitize_host(string $raw_host): stringSanitize a raw host value for drop-in cache-key decisions. Parameter Type Default Description $raw_hoststring— Raw host value (e.g. `$_SERVER[\’HTTP_HOST\’]`).
Return: string — Normalized lowercase host, or \’\’ when invalid.
privatestatic atomic_write_dropin()
private static function atomic_write_dropin(string $handler_code): boolAtomically write the drop-in via tmp-plus-rename with backup and verification. Parameter Type Default Description $handler_codestring— Generated drop-in code.
Return: bool — True on success (or when a foreign drop-in is left untouched), false on failure.
publicstatic create()
public static function create(): boolCreates the advanced-cache.php file.
Return: bool — True when the drop-in is left in a correct state (regenerated, already ours, or a foreign drop-in left untouched), false on filesystem failure.
publicstatic remove()
public static function remove(): voidRemoves the advanced-cache.php file.
Return: void.
publicstatic cleanup_stale_artifacts()
public static function cleanup_stale_artifacts(): voidDelete stale drop-in artifacts without touching the live drop-in.
Return: void.
privatestatic cleanup_dropin_artifacts()
private static function cleanup_dropin_artifacts(): voidDelete the backup sibling and any orphaned tmp siblings.
Return: void.