wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_cache_get_multiple_salted › WordPress Function
Since6.9.0
Deprecatedn/a
› wp_cache_get_multiple_salted ( $cache_keys, $group, $salt )
| Parameters: (3) |
|
| Returns: |
|
| Defined at: |
|
| Codex: |
Retrieves multiple items from the cache, only considering valid and unchanged items.
Related Functions: wp_cache_set_multiple_salted, wp_cache_get_multiple, wp_cache_set_multiple, wp_cache_get_salted, wp_cache_set_salted
Source
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;
}
endif;
if ( ! function_exists( 'wp_cache_set_multiple_salted' ) ) :
/**
* Stores multiple pieces of salted data in the cache.
*
* @since 6.9.0
*
* @param mixed $data Data to be stored in the cache for all keys.
* @param string $group Group to which the cached data belongs.
* @param string|string[] $salt The timestamp (or multiple timestamps if an array) indicating when the cache group(s) were last updated.
* @param int $expire Optional. When to expire the cache contents, in seconds.
* Default 0 (no expiration).
* @return bool[] Array of return values, grouped by key. Each value is either
* true on success, or false on failure.
*/