WC_Data::prime_raw_meta_data_cache()public staticWC 4.7.0

Prime caches for raw meta data. This includes meta_id column as well, which is not included by default in WP meta data.

Method of the class: WC_Data{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Data::prime_raw_meta_data_cache( $raw_meta_data_collection, $cache_group );
$raw_meta_data_collection(array) (required)
Array of objects of { object_id => array( meta_row_1, meta_row_2, ... }.
$cache_group(string) (required)
Name of cache group.

Changelog

Since 4.7.0 Introduced.

WC_Data::prime_raw_meta_data_cache() code WC 8.7.0

public static function prime_raw_meta_data_cache( $raw_meta_data_collection, $cache_group ) {
	foreach ( $raw_meta_data_collection as $object_id => $raw_meta_data_array ) {
		$cache_key = self::generate_meta_cache_key( $object_id, $cache_group );
		wp_cache_set( $cache_key, $raw_meta_data_array, $cache_group );
	}
}