Automattic\WooCommerce\Admin\API\Reports

DataStore::get_cache_key()protectedWC 1.0

Returns string to be used as cache key for the data.

Method of the class: DataStore{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_cache_key( $params );
$params(array) (required)
Query parameters.

DataStore::get_cache_key() code WC 7.3.0

protected function get_cache_key( $params ) {
	if ( isset( $params['force_cache_refresh'] ) ) {
		if ( true === $params['force_cache_refresh'] ) {
			$this->force_cache_refresh = true;
		}

		// We don't want this param in the key.
		unset( $params['force_cache_refresh'] );
	}

	if ( true === $this->debug_cache ) {
		$this->debug_cache_data['query_args'] = $params;
	}

	return implode(
		'_',
		array(
			'wc_report',
			$this->cache_key,
			md5( wp_json_encode( $params ) ),
		)
	);
}