*/ public function get_output() { $output = array( 'hit_percentage' => null, 'hits' => null, 'misses' => null, ); /** @var QM_Data_Cache $data */ $data = $this->collector->get_data(); if ( ! empty( $data->stats ) && ! empty( $data->cache_hit_percentage ) ) { $output['hit_percentage'] = round( $data->cache_hit_percentage, 1 ); $output['hits'] = (int) $data->stats['cache_hits']; $output['misses'] = (int) $data->stats['cache_misses']; } return $output; } } /** * @param array $output * @param QM_Collectors $collectors * @return array */ function register_qm_output_raw_cache( array $output, QM_Collectors $collectors ) { $collector = QM_Collectors::get( 'cache' ); if ( $collector ) { $output['cache'] = new QM_Output_Raw_Cache( $collector ); } return $output; } add_filter( 'qm/outputter/raw', 'register_qm_output_raw_cache', 30, 2 );