Automattic\WooCommerce\Caches
OrderCountCache::set_multiple
Set the cache count value for multiple statuses at once.
Метод класса: OrderCountCache{}
Хуков нет.
Возвращает
Массив<Строку,true|false>. Success map from wp_cache_set_multiple().
Использование
$OrderCountCache = new OrderCountCache(); $OrderCountCache->set_multiple( $order_type, $counts );
- $order_type(строка) (обязательный)
- The order type being set.
- $counts(array<string,int>) (обязательный)
- Normalized counts keyed by status slug (e.g. [
'wc-processing'=> 10,'wc-pending'=> 5 ]).
Код OrderCountCache::set_multiple() OrderCountCache::set multiple WC 11.0.1
public function set_multiple( string $order_type, array $counts ) {
if ( empty( $counts ) ) {
return array();
}
$this->ensure_statuses_for_type( $order_type, array_keys( $counts ) );
$mapped_counts = array();
foreach ( $counts as $status => $count ) {
$mapped_counts[ $this->get_cache_key( $order_type, $status ) ] = (int) $count;
}
return wp_cache_set_multiple( $mapped_counts, '', $this->expiration );
}