); $cache_engine->cache_objects( $meta_data, 0, $this->get_cache_group() ); } /** * Delete cached meta data for the given object_ids. * * @internal This method should only be used by internally and in cases where the CRUD operations of this datastore * are bypassed for performance purposes. This interface is not guaranteed. * * @param array $object_ids The object_ids to delete cache for. * * @return bool[] Array of return values, grouped by the object_id. Each value is either true on success, or false * if the contents were not deleted. */ public function clear_cached_data( array $object_ids ): array { if ( ! OrderUtil::custom_orders_table_datastore_cache_enabled() ) { return array_fill_keys( $object_ids, true ); } $cache_engine = wc_get_container()->get( WPCacheEngine::class ); $return_values = array(); foreach ( $object_ids as $object_id ) { $return_values[ $object_id ] = $cache_engine->delete_cached_object( $object_id, $this->get_cache_group() ); } return $return_values; } /** * Invalidate all the cache used by this data store. * * @internal This method should only be used by internally and in cases where the CRUD operations of this datastore * are bypassed for performance purposes. This interface is not guaranteed. * * @return bool Whether the cache as fully invalidated. */ public function clear_all_cached_data(): bool { if ( ! OrderUtil::custom_orders_table_datastore_cache_enabled() ) { return true; } $cache_engine = wc_get_container()->get( WPCacheEngine::class ); return $cache_engine->delete_cache_group( $this->get_cache_group() ); } }