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
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
| Version | Description |
|---|---|
| 7.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.