WP_Object_Cache::set_multiple() WordPress Method

The WP_Object_Cache::set_multiple() method is used to store multiple values in the WordPress object cache. This is useful for storing data that needs to be accessed by multiple scripts or processes.

WP_Object_Cache::set_multiple( array $data, string $group = '', int $expire ) #

Sets multiple values to the cache in one call.


Parameters

$data

(array)(Required)Array of key and value 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 always true.


Top ↑

Source

File: wp-includes/class-wp-object-cache.php

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

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

		return $values;
	}


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.