class-cache-key.php

Cache key boundary — key construction for transients, options, salts, and stampede guards.

Source includes/Cache/class-cache-key.php2 min readPart of Performance Optimisation

includes/Cache/class-cache-key.php

Cache key boundary — key construction for transients, options, salts, and stampede guards.

Namespace: PerformanceOptimise\\Inc · Lines: 142

Class Cache_Key

Class Cache_Key

Source: includes/Cache/class-cache-key.php, line 31

final class Cache_Key

Tags: @since 2.4.0

publicstatic transient_key()

public static function transient_key(string $key): string

Qualify a transient key with the current blog ID on multisite.

ParameterTypeDefaultDescription
$keystring—The bare transient key.

Return: string — Blog-ID-prefixed key on multisite, or the original key.

Tags: @since 2.4.0

Source: includes/Cache/class-cache-key.php, line 44

publicstatic option_key()

public static function option_key(string $key): string

Qualify an option name with the current blog ID on multisite.

ParameterTypeDefaultDescription
$keystring—The bare option name.

Return: string — Blog-ID-prefixed option name on multisite, or the original name.

Tags: @since 2.4.0

Source: includes/Cache/class-cache-key.php, line 68

publicstatic stampede_stale_key()

public static function stampede_stale_key(string $key): string

Derive the stale-copy transient key for a guarded value key.

ParameterTypeDefaultDescription
$keystring—Value cache key as passed to get_with_stampede_lock().

Return: string — Stale-copy key.

Tags: @since 2.4.0

Source: includes/Cache/class-cache-key.php, line 92

publicstatic cache_salt()

public static function cache_salt(string $option): string

Current value of a salted-cache salt (option-backed).

ParameterTypeDefaultDescription
$optionstring—Option key holding the salt.

Return: string — Current salt value (\’0\’ until the first bump).

Tags: @since 2.4.0

Source: includes/Cache/class-cache-key.php, line 133