wp_cache_get_multiple_salted( array $cache_keys, string $group, string|string[] $salt ): array
- Since
- 6.9.0
- Source
wp-includes/cache-compat.php:269
Compatibility
- WordPress
- since 6.9.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in 3 of the 5 tracked releases, added in 6.9.0, and compiles on PHP 7.4 through 8.6-dev.
Parameters
$cache_keysarray- Array of cache keys to retrieve.
$groupstring- The group of the cache to check.
$saltstring|string[]- The timestamp (or multiple timestamps if an array) indicating when the cache group(s) were last updated.
Return value
array- An associative array containing cache values. Values are
falseif they are not found or outdated.
Performance profile
How much work a call to wp_cache_get_multiple_salted() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Moderate
- Scaling
- Scales with input
- Instructions
- 15–17
- Plugin surface
- None
- Called by
- 1
Only touches the object cache, via wp_cache_get_multiple_salted().
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 38.
Nothing here hands control to plugin code.
1 place in core call this, so the cost is paid more often than your own code shows.
What it touches
- cacheobject cache
wp_cache_get_multiple_salted()this function does it
What one call costs · 1 distinct outcome
One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_cache_get_multiple_salted() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 15–17 | wp_cache_get_multiple() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 38 | 15–17 | 7 | |
| 8.5 | 38 | 15–17 | 7 | |
| 8.4 | 38 | 15–17 | 7 | 4 fewer instructions than PHP 8.3 |
| 8.3 | 42 | 15–21 | 7 | |
| 8.2 | 42 | 15–21 | 7 | |
| 8.1 | 42 | 15–21 | 7 | |
| 7.4 | 42 | 15–21 | 7 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 1
- wp_cache_get_multiple()Retrieves multiple values from the cache in one call.
Used by · 1
- WP_Comment_Query::fill_descendants()Fetch descendants for located comments.
Source code
function wp_cache_get_multiple_salted( $cache_keys, $group, $salt ) { $salt = is_array( $salt ) ? implode( ':', $salt ) : $salt; $cache = wp_cache_get_multiple( $cache_keys, $group ); foreach ( $cache as $key => $value ) { if ( ! is_array( $value ) ) { $cache[ $key ] = false; continue; } if ( ! isset( $value['salt'], $value['data'] ) || $salt !== $value['salt'] ) { $cache[ $key ] = false; continue; } $cache[ $key ] = $value['data']; } return $cache; }Changelog
Introduced in 6.9.0. Unchanged from 6.9.7 through 7.1.0.
Signature, return type and hooks compared across 3 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/cache-compat.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.