WP_Object_Cache::add_multiple() WordPress Method
The WP_Object_Cache::add_multiple() method is used to add multiple key/value pairs to the cache at once. The values in the key/value pairs must be serializable.
WP_Object_Cache::add_multiple( array $data, string $group = '', int $expire ) #
Adds multiple values to the cache in one call.
Parameters
- $data
(array)(Required)Array of keys and values to be added.
- $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).
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.
Source
File: wp-includes/class-wp-object-cache.php
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; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
6.0.0 | Introduced. |