WP_AI_Client_Cache::setMultiplepublicWP 7.0.0

Persists a set of key => value pairs in the cache, with an optional TTL.

Method of the class: WP_AI_Client_Cache{}

No Hooks.

Returns

true|false. True on success and false on failure.

Usage

$WP_AI_Client_Cache = new WP_AI_Client_Cache();
$WP_AI_Client_Cache->setMultiple( $values, $ttl ): bool;
$values(required)
.
$ttl(null|int|DateInterval)
The TTL value of this item.
Default: null

Changelog

Since 7.0.0 Introduced.

WP_AI_Client_Cache::setMultiple() code WP 7.0

public function setMultiple( $values, $ttl = null ): bool {
	$values_array = $this->iterable_to_array( $values );
	$expire       = $this->ttl_to_seconds( $ttl );
	$results      = wp_cache_set_multiple( $values_array, self::CACHE_GROUP, $expire );

	// Return true only if all operations succeeded.
	return ! in_array( false, $results, true );
}