*mysqlnd_qc_get_core_stats* -- Statistics collected by the core of the query
cache

  array mysqlnd_qc_get_core_stats()~

Returns an array of statistics collected by the core of the cache plugin. The
same data fields will be reported for any storage handler because the data is
collected by the core.

The PHP configuration setting mysqlnd_qc.collect_statistics controls the
collection of statistics. The collection of statistics is disabled by default
for performance reasons. Disabling the collection of statistics will also
disable the collection of time related statistics.

The PHP configuration setting mysqlnd_qc.collect_time_statistics controls the
collection of time related statistics.

The scope of the core statistics is the PHP process. Depending on your
deployment model a PHP process may handle one or multiple requests.

Statistics are aggregated for all cache entries. It is not possible to tell
how much queries originating from mysqli, PDO_MySQL or mysql API calls have
contributed to the aggregated data values.

This function has no parameters.

Array of core statistics

... and has been added to the cache

... but the PHP configuration directive setting of mysqlnd_qc.cache_no_table =
1 has prevented caching.

... but an unbuffered result set is requested.

... but a buffered result set was empty.

... and statement has been run without errors

... and meta data shows at least one column in the result set

<?php >
  /* Enable collection of statistics - default: disabled */
  ini_set("mysqlnd_qc.collect_statistics", 1);
  
  /* Enable collection of all timing related statistics -
  default: enabled but overruled by mysqlnd_qc.collect_statistics = 0 */
  ini_set("mysqlnd_qc.collect_time_statistics", 1);
  
  /* Populate the cache, e.g. using mysqli */
  $mysqli = new mysqli('host', 'user', 'password', 'schema');
  
  /* Cache miss and cache put */
  $mysqli->query("/*qc=on*/SELECT id FROM test");
  /* Cache hit */
  $mysqli->query("/*qc=on*/SELECT id FROM test");
  
  /* Display core statstics */
  var_dump(mysqlnd_qc_get_core_stats());
?>

The above examples will output:

  array(26) {
    ["cache_hit"]=>
    string(1) "1"
    ["cache_miss"]=>
    string(1) "1"
    ["cache_put"]=>
    string(1) "1"
    ["query_should_cache"]=>
    string(1) "2"
    ["query_should_not_cache"]=>
    string(1) "0"
    ["query_not_cached"]=>
    string(1) "0"
    ["query_could_cache"]=>
    string(1) "2"
    ["query_found_in_cache"]=>
    string(1) "1"
    ["query_uncached_other"]=>
    string(1) "0"
    ["query_uncached_no_table"]=>
    string(1) "0"
    ["query_uncached_no_result"]=>
    string(1) "0"
    ["query_uncached_use_result"]=>
    string(1) "0"
    ["query_aggr_run_time_cache_hit"]=>
    string(1) "4"
    ["query_aggr_run_time_cache_put"]=>
    string(3) "395"
    ["query_aggr_run_time_total"]=>
    string(3) "399"
    ["query_aggr_store_time_cache_hit"]=>
    string(1) "2"
    ["query_aggr_store_time_cache_put"]=>
    string(1) "8"
    ["query_aggr_store_time_total"]=>
    string(2) "10"
    ["receive_bytes_recorded"]=>
    string(2) "65"
    ["receive_bytes_replayed"]=>
    string(2) "65"
    ["send_bytes_recorded"]=>
    string(2) "29"
    ["send_bytes_replayed"]=>
    string(2) "29"
    ["slam_stale_refresh"]=>
    string(1) "0"
    ["slam_stale_hit"]=>
    string(1) "0"
    ["request_counter"]=>
    int(1)
    ["process_hash"]=>
    int(3547549858)
  }

Runtime configuration mysqlnd_qc.collect_statistics mysqlnd_qc.time_statistics

vim:ft=help:
