Automattic\WooCommerce\Admin\API\Reports\Products
DataStore::should_use_cache
Whether the report should be read from and written to the report cache.
Method of the class: DataStore{}
No Hooks.
Returns
bool.
Usage
// protected - for code of main (parent) or child class $result = $this->should_use_cache();
Changelog
| Since 11.2.0 | Introduced. |
DataStore::should_use_cache() DataStore::should use cache code WC 11.3.0
protected function should_use_cache() {
// Run the parent first, since it applies the filter plugins opt out of the cache through.
$use_cache = parent::should_use_cache();
// A search is resolved against product titles and SKUs while the report runs, and nothing
// invalidates the report cache when one is renamed, so a cached response would keep
// answering with the old matches for up to a week.
return $this->is_search ? false : $use_cache;
}