Automattic\WooCommerce\Blocks\BlockTypes

AbstractProductGrid::get_non_cached_ids()protectedWC 1.0

Retrieve IDs that are not already present in the cache.

Based on WordPress function: _get_non_cached_ids

Метод класса: AbstractProductGrid{}

Хуков нет.

Возвращает

int[]. Array of IDs not present in the cache.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_non_cached_ids( $product_ids, $cache_key );
$product_ids(int[]) (обязательный)
Array of IDs.
$cache_key(строка) (обязательный)
The cache bucket to check against.

Код AbstractProductGrid::get_non_cached_ids() WC 8.7.0

protected function get_non_cached_ids( $product_ids, $cache_key ) {
	$non_cached_ids = array();
	$cache_values   = wp_cache_get_multiple( $product_ids, $cache_key );

	foreach ( $cache_values as $id => $value ) {
		if ( ! $value ) {
			$non_cached_ids[] = (int) $id;
		}
	}

	return $non_cached_ids;
}