Automattic\WooCommerce\Blocks\BlockTypes
AbstractProductGrid::get_non_cached_ids
Retrieve IDs that are not already present in the cache.
Based on WordPress function: _get_non_cached_ids
Method of the class: AbstractProductGrid{}
No Hooks.
Returns
Int[]. Array of IDs not present in the cache.
Usage
// protected - for code of main (parent) or child class $result = $this->get_non_cached_ids( $product_ids, $cache_key );
- $product_ids(int[]) (required)
- Array of IDs.
- $cache_key(string) (required)
- The cache bucket to check against.
AbstractProductGrid::get_non_cached_ids() AbstractProductGrid::get non cached ids code WC 10.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;
}