Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableDataStoreMeta::clear_cached_data
Delete cached meta data for the given object_ids.
Method of the class: OrdersTableDataStoreMeta{}
No Hooks.
Returns
true|false[]. Array of return values, grouped by the object_id. Each value is either true on success, or false if the contents were not deleted.
Usage
$OrdersTableDataStoreMeta = new OrdersTableDataStoreMeta(); $OrdersTableDataStoreMeta->clear_cached_data( $object_ids ): array;
- $object_ids(array) (required)
- The object_ids to delete cache for.
OrdersTableDataStoreMeta::clear_cached_data() OrdersTableDataStoreMeta::clear cached data code WC 10.4.3
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;
}