Automattic\WooCommerce\Admin\API\Reports
DataStore::get_cache_key
Returns string to be used as cache key for the data.
Метод класса: DataStore{}
Хуков нет.
Возвращает
Строку.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_cache_key( $params );
- $params(массив) (обязательный)
- Query parameters.
Код DataStore::get_cache_key() DataStore::get cache key WC 10.5.2
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;
}
// Normalize the $params to reduce cache misses.
$params = array_filter(
$params,
function ( $param ) {
return ! empty( $param );
}
);
ksort( $params );
return implode(
'_',
array(
'wc_report',
$this->cache_key,
md5( wp_json_encode( $params ) ),
)
);
}