WP_Object_Cache::add_multiple()publicWP 6.0.0

Adds multiple values to the cache in one call.

Метод класса: WP_Object_Cache{}

Хуков нет.

Возвращает

true|false[]. Array of return values, grouped by key. Each value is either true on success, or false if cache key and group already exist.

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

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

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

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

Код WP_Object_Cache::add_multiple() WP 6.5.2

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

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

	return $values;
}