wp_cache_add_multiple() WordPress Function

The wp_cache_add_multiple() function allows you to add multiple values to the cache at once. This is useful for reducing the number of cache calls, and can improve performance.

wp_cache_add_multiple( array $data, string $group = '', int $expire ) #

Adds multiple values to the cache in one call.


Description

Top ↑

See also


Top ↑

Parameters

$data

(array)(Required)Array of keys and values to be set.

$group

(string)(Optional) Where the cache contents are grouped.

Default value: ''

$expire

(int)(Optional) When to expire the cache contents, in seconds. Default 0 (no expiration).


Top ↑

Return

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


Top ↑

Source

File: wp-includes/cache.php

function wp_cache_add_multiple( array $data, $group = '', $expire = 0 ) {
	global $wp_object_cache;

	return $wp_object_cache->add_multiple( $data, $group, $expire );
}


Top ↑

Changelog

Changelog
VersionDescription
6.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.