wp_cache_set_multiple()WP 6.0.0

Sets multiple values to the cache in one call.

Differs from wp_cache_add_multiple() in that it will always write data.

Compat function to mimic wp_cache_set_multiple().

Хуков нет.

Возвращает

true|false[]. Array of return values, grouped by key. Each value is either true on success, or false on failure.

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

wp_cache_set_multiple( $data, $group, $expire );
$data(массив) (обязательный)
Array of keys and values to be set.
$group(строка)
Where the cache contents are grouped.
По умолчанию: ''
$expire(int)
When to expire the cache contents, in seconds.
По умолчанию: 0 (no expiration)

Заметки

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

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

Код wp_cache_set_multiple() WP 6.1.1

function wp_cache_set_multiple( array $data, $group = '', $expire = 0 ) {
	$values = array();

	foreach ( $data as $key => $value ) {
		$values[ $key ] = wp_cache_set( $key, $value, $group, $expire );
	}

	return $values;
}