Remove order and product factory cache
This commit is contained in:
parent
795e6871c0
commit
c4c8edee5f
|
@ -469,7 +469,6 @@ abstract class WC_Data {
|
|||
|
||||
if ( ! empty( $this->cache_group ) ) {
|
||||
WC_Cache_Helper::incr_cache_prefix( $this->cache_group );
|
||||
wp_cache_delete( 'object-' . $this->get_id(), $this->cache_group );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,15 +44,7 @@ class WC_Order_Factory {
|
|||
}
|
||||
|
||||
try {
|
||||
// Try to get from cache, otherwise create a new object,
|
||||
$order = wp_cache_get( 'object-' . $order_id, 'orders' );
|
||||
|
||||
if ( ! is_a( $order, 'WC_Order' ) ) {
|
||||
$order = new $classname( $order_id );
|
||||
wp_cache_set( 'object-' . $order_id, $order, 'orders' );
|
||||
}
|
||||
|
||||
return $order;
|
||||
return new $classname( $order_id );
|
||||
} catch ( Exception $e ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -107,15 +99,7 @@ class WC_Order_Factory {
|
|||
|
||||
if ( $classname && class_exists( $classname ) ) {
|
||||
try {
|
||||
// Try to get from cache, otherwise create a new object,
|
||||
$item = wp_cache_get( 'object-' . $id, 'order-items' );
|
||||
|
||||
if ( ! is_a( $item, 'WC_Order_Item' ) ) {
|
||||
$item = new $classname( $id );
|
||||
wp_cache_set( 'object-' . $id, $item, 'order-items' );
|
||||
}
|
||||
|
||||
return $item;
|
||||
return new $classname( $id );
|
||||
} catch ( Exception $e ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -43,15 +43,7 @@ class WC_Product_Factory {
|
|||
$classname = $this->get_product_classname( $product_id, $product_type );
|
||||
|
||||
try {
|
||||
// Try to get from cache, otherwise create a new object,
|
||||
$product = wp_cache_get( 'product-' . $product_id, 'products' );
|
||||
|
||||
if ( ! is_a( $product, 'WC_Product' ) ) {
|
||||
$product = new $classname( $product_id, $deprecated );
|
||||
wp_cache_set( 'product-' . $product_id, $product, 'products' );
|
||||
}
|
||||
|
||||
return $product;
|
||||
return new $classname( $product_id, $deprecated );
|
||||
} catch ( Exception $e ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -695,7 +695,6 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
|
|||
*/
|
||||
protected function clear_caches( &$product ) {
|
||||
wc_delete_product_transients( $product->get_id() );
|
||||
wp_cache_delete( 'object-' . $product->get_id(), 'products' );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue