WP_AI_Client_Cache::setMultiple( $values, null|int|DateInterval $ttl = null ): bool

In this article

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

Parameters

mixed> $values A list of key => value pairs for a multiple-set operation.
$ttlnull|int|DateIntervaloptional
The TTL value of this item.

Default:null

Return

bool True on success and false on failure.

Source

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 );
}

Changelog

VersionDescription
7.0.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.