Invalidate API caches when updating analytics settings. (https://github.com/woocommerce/woocommerce-admin/pull/3465)
This commit is contained in:
parent
402294c500
commit
b742c132da
|
@ -11,6 +11,8 @@ namespace Automattic\WooCommerce\Admin\API;
|
|||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use \Automattic\WooCommerce\Admin\API\Reports\Cache as ReportsCache;
|
||||
|
||||
/**
|
||||
* Setting Options controller.
|
||||
*
|
||||
|
@ -25,4 +27,18 @@ class SettingOptions extends \WC_REST_Setting_Options_Controller {
|
|||
* @var string
|
||||
*/
|
||||
protected $namespace = 'wc-analytics';
|
||||
|
||||
/**
|
||||
* Invalidates API cache when updating settings options.
|
||||
*
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return array Of WP_Error or WP_REST_Response.
|
||||
*/
|
||||
public function batch_items( $request ) {
|
||||
// Invalidate the API cache.
|
||||
ReportsCache::invalidate();
|
||||
|
||||
// Process the request.
|
||||
return parent::batch_items( $request );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue