includes/CSS/class-ccss-generator.php
Critical CSS generation lifecycle policy.
Class Ccss_Generator
Critical CSS generation lifecycle policy.
final class Ccss_GeneratorConstants
| Constant | Visibility | Value | Line |
|---|---|---|---|
SALT_KEY | private | \'wppo_ccss_salt\' | 37 |
CCSS_AS_GROUP | private | \'wppo-ccss\' | 44 |
DEFAULT_CCSS_MAX_RETRIES | private | 5 | 51 |
MAX_CCSS_MAX_RETRIES | private | 5 | 58 |
MAX_CCSS_TIMEOUT_ATTEMPTS | private | 5 | 65 |
Properties
| Property | Visibility | Type | Default | Line |
|---|---|---|---|---|
$pending_memo | private static | array | array() | 72 |
publicstatic get_ccss_max_retries()
public static function get_ccss_max_retries(): intRead the bounded generic retry cap.
Return: int — Retry cap, 0..5.
publicstatic get_generation_attempts()
public static function get_generation_attempts(string $template_hash): intRead consecutive generic failures for a template. Parameter Type Default Description $template_hashstring— Template hash.
Return: int — Failure count.
publicstatic clear_generation_attempts()
public static function clear_generation_attempts(string $template_hash): voidClear consecutive generic failures. Parameter Type Default Description $template_hashstring— Template hash.
Return: void.
publicstatic get_timeout_attempts()
public static function get_timeout_attempts(string $template_hash): intRead consecutive timeout failures. Parameter Type Default Description $template_hashstring— Template hash.
Return: int — Timeout count.
publicstatic clear_timeout_attempts()
public static function clear_timeout_attempts(string $template_hash): voidClear consecutive timeout failures and their first-seen stamp. Parameter Type Default Description $template_hashstring— Template hash.
Return: void.
publicstatic clear_retry_state()
public static function clear_retry_state(string $template_hash): voidClear all bounded retry state for a template. Parameter Type Default Description $template_hashstring— Template hash.
Return: void.
publicstatic get_status_cache()
public static function get_status_cache(string $hash)Read a generation status from salted cache or transient fallback. Parameter Type Default Description $hashstring— Template hash.
Return: string|false — Status or false when unset.
publicstatic set_status_cache()
public static function set_status_cache(string $hash, string $status, int $ttl): voidStore a generation status in salted cache and transient fallback. Parameter Type Default Description $hashstring— Template hash. $statusstring— Status value. $ttlint— Time to live in seconds.
Return: void.
publicstatic has_pending_job()
public static function has_pending_job(string $hook, array $hook_args): boolWhether a generation job is pending or running in either AS group. Parameter Type Default Description $hookstring— Action hook. $hook_argsarray— Action arguments.
Return: bool — True when a matching action is live.
publicstatic schedule_job()
public static function schedule_job(string $hook, array $hook_args, int $timestamp): arrayAtomically enqueue one generation job with the historic group matrix. Parameter Type Default Description $hookstring— Action hook. $hook_argsarray— Wrapped action arguments. $timestampint— When the job should run.
Return: array{id:int,pending:bool} — Enqueue result.
publicstatic schedule_retry()
public static function schedule_retry(string $template_hash, ?int=null $attempts): arraySchedule a bounded exponential retry. Parameter Type Default Description $template_hashstring— Template hash. $attempts?int=null— Optional generic attempt count.
Return: array{id:int,pending:bool} — Enqueue result.
publicstatic record_generation_failure()
public static function record_generation_failure(string $template_hash, int $budget, ?float $deadline): voidRecord an ordinary generation failure and schedule a retry. Parameter Type Default Description $template_hashstring— Template hash. $budgetint— Generation budget in seconds. $deadline?float— Absolute deadline, if bounded.
Return: void.
publicstatic handle_timeout()
public static function handle_timeout(string $template_hash, int $budget): voidRecord a generation timeout and schedule bounded retry/escalation. Parameter Type Default Description $template_hashstring— Template hash. $budgetint— Generation budget in seconds.
Return: void.
publicstatic generation_expired()
public static function generation_expired(?float $deadline): boolWhether an absolute generation deadline has expired. Parameter Type Default Description $deadline?float— Absolute deadline, or null for uncapped.
Return: bool — True when expired.
publicstatic bump_status_salt()
public static function bump_status_salt(): voidBump the status-cache salt so all salted statuses are invalidated.
Return: void.
publicstatic reset_pending_memo()
public static function reset_pending_memo(): voidReset the per-request pending-job memo.
Return: void.
privatestatic memoize_pending()
private static function memoize_pending(string $hook, array $hook_args): voidMemoize a confirmed pending action key. Parameter Type Default Description $hookstring— Action hook. $hook_argsarray— Action arguments.
Return: void.
Hooks
Hooks referenced in includes/CSS/class-ccss-generator.php: Hook Type Line Notes wppo_ccss_max_retriesfilter 87 —