wp_cache_get_multiple_salted() │ WP 6.9.0

Retrieves multiple items from the cache, only considering valid and unchanged items.

Хуков нет.

Возвращает

array. An associative array containing cache values. Values are false if they are not found or outdated.

Использование

wp_cache_get_multiple_salted( $cache_keys, $group, $salt );
$cache_keys(массив) (обязательный)
Array of cache keys to retrieve.
$group(строка) (обязательный)
The group of the cache to check.
$salt(строка|string[]) (обязательный)
The timestamp (or multiple timestamps if an array) indicating when the cache group(s) were last updated.

Список изменений

С версии 6.9.0 Введена.

Код wp_cache_get_multiple_salted() WP 7.1.3

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;
}