mysqlnd_qc_get_cache_info

mysqlnd_qc_get_cache_info — Returns information on the current handler, the number of cache entries and cache entries, if available

Description

arraymysqlnd_qc_get_cache_info
( void
)

Parameters

This function has no parameters.

Return Values

Returns information on the current handler, the number of cache entries and
cache entries, if available. If and what data will be returned for the cache
entries is subject to the active storage handler.
Storage handler are free to return any data. Storage handler are
recommended to return at least the data provided by the default handler,
if technically possible.

The scope of the information is the PHP process. Depending on the PHP deployment
model a process may serve one or more web requests.

Values are aggregated for all cache activities on a per storage handler basis.
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. Use
mysqlnd_qc_get_core_stats()
to get timing data aggregated for all storage handlers.

Additional storage handler dependent data on the cache entries.
Storage handler are requested to provide similar and comparable
information. A user defined storage handler is free to return any data.

Since 1.0.0.

The following information is provided by the default storage handler
for the data property.

The data
property holds a hash. The hash is indexed by the internal
cache entry identifier of the storage handler. The cache entry identifier
is human-readable and contains the query string leading to the cache entry.
Please, see also the example below. The following data is given for
every cache entry.

The size of the cached result set in bytes. This is the size
of the payload. The value is not suited for calculating the
total memory consumption of all cache entries including the
administrative overhead of the cache entries.

Since 1.0.0.

cache_hits

How often the cached entry has been returned.

Since 1.0.0.

run_time

Run time of the statement to which the cache entry belongs.
This is the run time of the uncached statement. It is the time
between sending the statement to MySQL receiving a reply from MySQL.
Run time saved by using the query cache plugin can be calculated
like this: cache_hits * ((run_time - avg_run_time) + (store_time - avg_store_time)).

Since 1.0.0.

store_time

Store time of the statements result set to which the cache entry belongs.
This is the time it took to fetch and store the results of the uncached
statement.

Since 1.0.0.

min_run_time

Minimum run time of the cached statement. How long it took
to find the statement in the cache.

Since 1.0.0.

min_store_time

Minimum store time of the cached statement. The time taken
for fetching the cached result set from the storage medium and
decoding

Metadata of the cache entry.
This is the metadata provided by MySQL together with the
result set of the statement in question. Different versions
of the MySQL server may return different metadata. Unlike with
some of the PHP MySQL extensions no attempt is made to hide
MySQL server version dependencies and version details from the
caller. Please, refer to the MySQL C API documentation that
belongs to the MySQL server in use for further details.

The metadata list contains one entry for every column.

Since 1.0.0.

Property

Description

Version

name

The field name. Depending on the MySQL version this
may be the fields alias name.

Since 1.0.0.

org_name

The field name.

Since 1.0.0.

table

The table name. If an alias name was used for the table, this
usually holds the alias name.

Since 1.0.0.

org_table

The table name.

Since 1.0.0.

db

The database/schema name.

Since 1.0.0.

max_length

The maximum width of the field. Details may vary by MySQL server version.

Since 1.0.0.

length

The width of the field. Details may vary by MySQL server version.

Since 1.0.0.

type

The data type of the field. Details may vary by the MySQL server in use.
This is the MySQL C API type constants value. It is recommended
to use type constants provided by the mysqli extension
to test for its meaning. You should not test for certain type values
by comparing with certain numbers.

Since 1.0.0.

The APC storage handler returns the same information
for the data property but no metadata.
The metadata of a cache entry is set to NULL.

The MEMCACHE storage handler does not fill the data property.
Statistics are not available on a per cache entry basis with the MEMCACHE storage
handler.

A user defined storage handler is free to provide any data.

Examples

Example #1 mysqlnd_qc_get_cache_info() example

The example shows the output from the built-in default storage handler.
Other storage handler may report different data.