diff --git a/reference/mysqlnd_qc/book.xml b/reference/mysqlnd_qc/book.xml index 87061bfc7c..24d31ea275 100644 --- a/reference/mysqlnd_qc/book.xml +++ b/reference/mysqlnd_qc/book.xml @@ -3,229 +3,229 @@ - Mysqlnd query result cache plugin - mysqlnd_qc + Mysqlnd query result cache plugin + mysqlnd_qc - + &reftitle.intro; - - The mysqlnd query result cache plugin adds easy to use client-side query - caching to all PHP MySQL extensions using - mysqlnd. - - - As of version PHP 5.3.3 the MySQL native driver for PHP ( - mysqlnd) - features an internal plugin C API. C plugins, such as the query cache - plugin, can extend the functionality of - mysqlnd. - - - The MySQL native driver for PHP is a C library which ships together with - PHP as of PHP 5.3.0. It serves as a drop-in replacement for the - MySQL Client Library (AKA libmysql/libmysqlclient). Using mysqlnd has - several advantages: no extra downloads because it comes with PHP, - PHP license, lower memory consumption in certain cases, - new functionality such as asynchronous queries. - - - Mysqlnd plugins such as the query cache plugin operate transparent - from a user perspective. The cache plugin supports all PHP applications - and all PHP MySQL extensions ( - mysqli, - mysql, - PDO_MYSQL). - It does not change existing APIs. - - - No significant application changes are required to cache a query. - The cache has two operation modes. It will either cache all - queries (not recommended) or only those queries marked with a - certain SQL hint (recommended). - + + The mysqlnd query result cache plugin adds easy to use client-side query + caching to all PHP MySQL extensions using + mysqlnd. + + + As of version PHP 5.3.3 the MySQL native driver for PHP ( + mysqlnd) + features an internal plugin C API. C plugins, such as the query cache + plugin, can extend the functionality of + mysqlnd. + + + The MySQL native driver for PHP is a C library which ships together with + PHP as of PHP 5.3.0. It serves as a drop-in replacement for the + MySQL Client Library (AKA libmysql/libmysqlclient). Using mysqlnd has + several advantages: no extra downloads because it comes with PHP, + PHP license, lower memory consumption in certain cases, + new functionality such as asynchronous queries. + + + Mysqlnd plugins such as the query cache plugin operate transparent + from a user perspective. The cache plugin supports all PHP applications + and all PHP MySQL extensions ( + mysqli, + mysql, + PDO_MYSQL). + It does not change existing APIs. + + + No significant application changes are required to cache a query. + The cache has two operation modes. It will either cache all + queries (not recommended) or only those queries marked with a + certain SQL hint (recommended). + -
- Key Features +
+ Key Features + + + - - - - Transparent and therefore easy to use - - - - - - supports all PHP MySQL extensions - - - - - no API changes - - - - - very little application changes required - - - - - + Transparent and therefore easy to use + + + + + + supports all PHP MySQL extensions + + + + + no API changes + + + + + very little application changes required + + + + + - - - Flexible invalidation strategy - - - - - - Time-to-Live (TTL) - - - - - user-defined - - - - - + + + Flexible invalidation strategy + + + + + + Time-to-Live (TTL) + + + + + user-defined + + + + + - - - Storage with different scope and life-span - - - - - - Default (Hash) - - - - - APC - - - - - MEMCACHE - - - - - sqlite - - - - - user-defined - - - - - - + + + Storage with different scope and life-span -
+ + + + + Default (Hash) + + + + + APC + + + + + MEMCACHE + + + + + sqlite + + + + + user-defined + + + + + + + +
-
- Limitations +
+ Limitations + + The query cache plugin prototype will not cache unbuffered + queries or results from prepared statements. This limitation + is likely to be lifted soon. + + + The following popular user API calls use buffered queries which + can be cached: + + + + - The query cache plugin prototype will not cache unbuffered - queries or results from prepared statements. This limitation - is likely to be lifted soon. + mysqli + + + + mysqli_query + + + + + mysqli_real_query + + mysqli_store_result + + + + + - The following popular user API calls use buffered queries which - can be cached: + PDO_MYSQL + + + + PDO::query if + PDO::ATTR_EMULATE_PREPARES = 1 (default setting) + + + + + - - - - mysqli - - - - mysqli_query - - - - - mysqli_real_query + - mysqli_store_result - - - - - - - - PDO_MYSQL - - - - PDO::query if - PDO::ATTR_EMULATE_PREPARES = 1 (default setting) - - - - - - - - mysql - - - - mysql_query - - - - - - - + mysql + + + + mysql_query + + + -
- -
- Architecture - - The query cache is implemented as a PHP extension. - It is written in C and operates under the hood of PHP. During the - startup of the PHP interpreter it gets registered as a - mysqlnd plugin to replace selected - mysqlnd C methods. - - - At PHP run time it proxies queries send from - mysqlnd (PHP) to the MySQL server. If a query string starts with the SQL hint - ( - /*qc=on*/) to enable caching of it and the query - is not cached (cache miss), the query cache plugin will record the - raw wire protocol data send from MySQL to PHP to answer the query. - The query cache records the wire protocol data in its cache - and replays it, if still valid, on a cache hit. - - - Note that the query cache does not hold decoded result sets consisting - of - zvals (C struct representing a PHP variable). - It stores the raw wire data of the MySQL client server protocol. - In case of a cache hits, - mysqlnd still needs - to decode the cached raw wire data into PHP variables before passing - the result to the user space. - This approach has one major advantage: simplicity. Furthermore this - approach eliminates the need for serializing data for cache storage. - -
- + + + +
+ +
+ Architecture + + The query cache is implemented as a PHP extension. + It is written in C and operates under the hood of PHP. During the + startup of the PHP interpreter it gets registered as a + mysqlnd plugin to replace selected + mysqlnd C methods. + + + At PHP run time it proxies queries send from + mysqlnd (PHP) to the MySQL server. If a query string starts with the SQL hint + ( + /*qc=on*/) to enable caching of it and the query + is not cached (cache miss), the query cache plugin will record the + raw wire protocol data send from MySQL to PHP to answer the query. + The query cache records the wire protocol data in its cache + and replays it, if still valid, on a cache hit. + + + Note that the query cache does not hold decoded result sets consisting + of + zvals (C struct representing a PHP variable). + It stores the raw wire data of the MySQL client server protocol. + In case of a cache hits, + mysqlnd still needs + to decode the cached raw wire data into PHP variables before passing + the result to the user space. + This approach has one major advantage: simplicity. Furthermore this + approach eliminates the need for serializing data for cache storage. + +
+ +
&reference.mysqlnd-qc.setup; diff --git a/reference/mysqlnd_qc/configure.xml b/reference/mysqlnd_qc/configure.xml index 0662f49db1..b45aafc395 100644 --- a/reference/mysqlnd_qc/configure.xml +++ b/reference/mysqlnd_qc/configure.xml @@ -3,18 +3,18 @@
&reftitle.install; - - &pecl.moved; - + + &pecl.moved; + - + &pecl.info; - &url.pecl.package;mysqlnd_qc - + &url.pecl.package;mysqlnd_qc + - - &pecl.windows.download; - + + &pecl.windows.download; +
diff --git a/reference/mysqlnd_qc/constants.xml b/reference/mysqlnd_qc/constants.xml index c26d5d1135..c193122dde 100644 --- a/reference/mysqlnd_qc/constants.xml +++ b/reference/mysqlnd_qc/constants.xml @@ -4,25 +4,25 @@ &reftitle.constants; &extension.constants; - - SQL hint related - - - - - The query cache is controled by SQL hints. SQL hints are used to enable and - disable caching. SQL hints can be used to set the - TTL of a query. - - - The SQL hints recognized by the query cache can be manually changed at - compile time. This makes it possible to use - mysqlnd_qc in environments in which the default - SQL hints are already taken and interpreted by other systems. Therefore - it is recommended to use the SQL hint string constants instead of - manually adding the default SQL hints to the query string. - - + + SQL hint related + + + + + The query cache is controled by SQL hints. SQL hints are used to enable and + disable caching. SQL hints can be used to set the + TTL of a query. + + + The SQL hints recognized by the query cache can be manually changed at + compile time. This makes it possible to use + mysqlnd_qc in environments in which the default + SQL hints are already taken and interpreted by other systems. Therefore + it is recommended to use the SQL hint string constants instead of + manually adding the default SQL hints to the query string. + + ]]> - + &examples.outputs; - + - + - - + + - - - - - MYSQLND_QC_ENABLE_SWITCH + + + + + MYSQLND_QC_ENABLE_SWITCH ( - string) - - - + string) + + + SQL hint used to enable caching of a query. - - - - - - - MYSQLND_QC_DISABLE_SWITCH + + + + + + + MYSQLND_QC_DISABLE_SWITCH ( - string) - - - - SQL hint used to disable caching of a query if - mysqlnd_qc.cache_by_default = 1. - - - - - - MYSQLND_QC_TTL_SWITCH + string) + + + + SQL hint used to disable caching of a query if + mysqlnd_qc.cache_by_default = 1. + + + + + + MYSQLND_QC_TTL_SWITCH ( - string) - - - - SQL hint used to set the TTL of a result set. - - - - - + string) + + + + SQL hint used to set the TTL of a result set. + + + + + diff --git a/reference/mysqlnd_qc/functions/mysqlnd-qc-change-handler.xml b/reference/mysqlnd_qc/functions/mysqlnd-qc-change-handler.xml index 3673723324..21f6f239a2 100644 --- a/reference/mysqlnd_qc/functions/mysqlnd-qc-change-handler.xml +++ b/reference/mysqlnd_qc/functions/mysqlnd-qc-change-handler.xml @@ -2,76 +2,77 @@ - - mysqlnd_qc_change_handler - Change current storage handler - + + mysqlnd_qc_change_handler + Change current storage handler + - + &reftitle.description; - - bool - mysqlnd_qc_change_handler - - mixed - handler - - - - Sets the storage handler used by the query cache. A list of available - storage handler can be obtained from mysqlnd_qc_get_handler. - Which storage are available depends on the compile time - configuration of the query cache plugin. The - default storage handler is always available. - All other storage handler must be enabled explicitly when building the - extension. - + + bool + mysqlnd_qc_change_handler + + mixed + handler + + + + Sets the storage handler used by the query cache. A list of available + storage handler can be obtained from + mysqlnd_qc_get_handler. + Which storage are available depends on the compile time + configuration of the query cache plugin. The + default storage handler is always available. + All other storage handler must be enabled explicitly when building the + extension. + - + - + &reftitle.parameters; - - - - handler - - - - Handler can be of type string representing the name of a - built-in storage handler or an object of type - mysqlnd_qc_handler_default. - The names of the built-in storage handler are - default, - APC, - MEMCACHE, - sqlite. - - - - - + + + + handler + + + + Handler can be of type string representing the name of a + built-in storage handler or an object of type + mysqlnd_qc_handler_default. + The names of the built-in storage handler are + default, + APC, + MEMCACHE, + sqlite. + + + + + - + &reftitle.returnvalues; - + &return.success; - - - If changing the storage handler fails a catchable fatal error will - be thrown. The query cache cannot operate if the previous storage - handler has been shutdown but no new storage handler has been installed. - - + + + If changing the storage handler fails a catchable fatal error will + be thrown. The query cache cannot operate if the previous storage + handler has been shutdown but no new storage handler has been installed. + + - + &reftitle.examples; - - - The example shows the output from the built-in default storage handler. - Other storage handler may report different data. - - + + + The example shows the output from the built-in default storage handler. + Other storage handler may report different data. + + ]]> - + &examples.outputs; - + - + - - + + - + &reftitle.seealso; - - - - Installation - - - mysqlnd_qc_get_handler - - - - + + + + Installation + + + + mysqlnd_qc_get_handler + + + + + diff --git a/reference/mysqlnd_qc/functions/mysqlnd-qc-clear-cache.xml b/reference/mysqlnd_qc/functions/mysqlnd-qc-clear-cache.xml index ccde9b5421..1a2ddc4fc1 100644 --- a/reference/mysqlnd_qc/functions/mysqlnd-qc-clear-cache.xml +++ b/reference/mysqlnd_qc/functions/mysqlnd-qc-clear-cache.xml @@ -2,55 +2,55 @@ - - mysqlnd_qc_clear_cache - Flush all cache contents - + + mysqlnd_qc_clear_cache + Flush all cache contents + - + &reftitle.description; - - bool - mysqlnd_qc_clear_cache - - - - Flush all cache contents. - - - Flushing the cache is a storage handler responsibility. - All built-in storage handler but the - memcache storage - handler support flushing the cache. The - memcache - storage handler cannot flush its cache contents. - - - User-defined storage handler may or may not support the operation. - + + bool + mysqlnd_qc_clear_cache + + + + Flush all cache contents. + + + Flushing the cache is a storage handler responsibility. + All built-in storage handler but the + memcache storage + handler support flushing the cache. The + memcache + storage handler cannot flush its cache contents. + + + User-defined storage handler may or may not support the operation. + - + - + &reftitle.parameters; &no.function.parameters; - + - + &reftitle.returnvalues; - + &return.success; - - - A return value of - FALSE - indicates that flushing all cache contents has - failed or the operation is not supported by - the active storage handler. Applications must - not expect that calling the function will always - flush the cache. - - + + + A return value of + FALSE + indicates that flushing all cache contents has + failed or the operation is not supported by + the active storage handler. Applications must + not expect that calling the function will always + flush the cache. + + diff --git a/reference/mysqlnd_qc/functions/mysqlnd-qc-get-cache-info.xml b/reference/mysqlnd_qc/functions/mysqlnd-qc-get-cache-info.xml index 3230725cb4..3d8a728ca8 100644 --- a/reference/mysqlnd_qc/functions/mysqlnd-qc-get-cache-info.xml +++ b/reference/mysqlnd_qc/functions/mysqlnd-qc-get-cache-info.xml @@ -2,49 +2,49 @@ - - mysqlnd_qc_get_cache_info - Returns information on the current handler, the number of cache entries and cache entries, if available - + + mysqlnd_qc_get_cache_info + Returns information on the current handler, the number of cache entries and cache entries, if available + - + &reftitle.description; - - array - mysqlnd_qc_get_cache_info - - - - - + + array + mysqlnd_qc_get_cache_info + + + - + - + + + &reftitle.parameters; &no.function.parameters; - + - + &reftitle.returnvalues; - - 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. - - - - + + 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. + + + + &reftitle.examples; - - - The example shows the output from the built-in default storage handler. - Other storage handler may report different data. - - + + + The example shows the output from the built-in default storage handler. + Other storage handler may report different data. + + query("/*" . MYSQLND_QC_ENABLE_SWITCH . "*/SELECT id FROM test"); var_dump(mysqlnd_qc_get_cache_info()); ?> ]]> - + &examples.outputs; - + @@ -122,10 +122,10 @@ array(4) { } ]]> - + - - + + diff --git a/reference/mysqlnd_qc/functions/mysqlnd-qc-get-core-stats.xml b/reference/mysqlnd_qc/functions/mysqlnd-qc-get-core-stats.xml index e3d0e1c4fc..538e35273c 100644 --- a/reference/mysqlnd_qc/functions/mysqlnd-qc-get-core-stats.xml +++ b/reference/mysqlnd_qc/functions/mysqlnd-qc-get-core-stats.xml @@ -2,385 +2,384 @@ - - mysqlnd_qc_get_core_stats - Statistics collected by the core of the query cache - + + mysqlnd_qc_get_core_stats + Statistics collected by the core of the query cache + - + &reftitle.description; - - 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. - - + + 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. + + - + &reftitle.parameters; &no.function.parameters; - + - + &reftitle.returnvalues; - + Array of core statistics - - - - - - - - - Statistic - Description - Version - - - - - - cache_hit - - - Statement is considered cacheable and cached data has been reused. - Statement is considered cacheable and a cache miss happened but - the statement got cached by someone else while we process it and thus - we can fetch the result from the refreshed cache. - - Since 1.0.0. - - - - cache_miss - - - Statement is considered cacheable... - - - - ... 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. - - - - - Since 1.0.0. - - - - cache_put - - - Statement is considered cacheable and has been added to the cache. - Take care when calculating derived statistics. Storage handler - with a storage life time beyond process scope may report - cache_put = 0 together with - cache_hit > 0, if another process has filled - the cache. You may want to use - num_entries from - mysqlnd_qc_get_cache_info if the handler - supports it ( - default, - APC). - - Since 1.0.0. - - - - query_should_cache - - - Statement is considered cacheable based on query string analysis. - The statement may or may not be added to the cache. See also - cache_put. - - Since 1.0.0. - - - - query_should_not_cache - - - Statement is considered not cacheable based on query string analysis. - - Since 1.0.0. - - - - query_not_cached - - - Statement is considered not cacheable or it is - considered cachable but the storage handler has not returned a - hash key for it. - - Since 1.0.0. - - - - query_could_cache - - - Statement is considered cacheable... - - - - ... and statement has been run without errors - - - - - ... and meta data shows at least one column in the result set - - - - The statement may or may not be in the cache already. - It may or may not be added to the cache later on. - - Since 1.0.0. - - - - query_found_in_cache - - - Statement is considered cacheable and we have found it in the cache - but we have not replayed the cached data yet and we have not send - the result set to the client yet. This is not considered - a cache hit because the client might not fetch the result or - the cached data may be faulty. - - Since 1.0.0. - - - - query_uncached_other - - - Statement is considered cacheable and it may or may not be in - the cache already but either replaying cached data has failed, - no result set is available or some other error has happened. - - - - - query_uncached_no_table - - - Statement has not been cached because the result set has at least - one column which has no table name in its meta data. An example of - such a query is - SELECT SLEEP(1). To cache those - statements you have to change default value of the PHP configuration directive - mysqlnd_qc.cache_no_table and set - mysqlnd_qc.cache_no_table = 1. Often is is not - desired to cache such statements. - - Since 1.0.0. - - - - query_uncached_use_result - - - Statement would have been cached if a buffered result set - had been used. The situation is also consiered as a cache miss and - cache_miss will be incremented as well. - - Since 1.0.0. - - - - query_aggr_run_time_cache_hit - - - Aggregated run time (ms) of all cached queries. - Cached queries are those which have incremented - cache_hit. - - Since 1.0.0. - - - - query_aggr_run_time_cache_put - - - Aggregated run time (ms) of all uncached queries that - have been put into the cache. See also - cache_put. - - Since 1.0.0. - - - - query_aggr_run_time_total - - - Aggregated run time (ms) of all uncached and cached queries - that have been inspected and executed by the query cache. - - Since 1.0.0. - - - - query_aggr_store_time_cache_hit - - - Aggregated store time (ms) of all cached queries. - Cached queries are those which have incremented - cache_hit. - - Since 1.0.0. - - - - query_aggr_store_time_cache_put - - - Aggregated store time ( - ms) of all uncached queries that - have been put into the cache. See also - cache_put. - - Since 1.0.0. - - - - query_aggr_store_time_total - - - Aggregated store time (ms) of all uncached and cached queries - that have been inspected and executed by the query cache. - - Since 1.0.0. - - - - receive_bytes_recorded - - - Recorded incoming network traffic ( - bytes) send from MySQL to PHP. - The traffic may or may not have been added to the cache. The - traffic is the total for all queries regardless if cached or not. - - Since 1.0.0. - - - - receive_bytes_replayed - - - Network traffic replayed during cache. This is the total amount of - incoming traffic saved because of the usage of the query cache plugin. - - Since 1.0.0. - - - - send_bytes_recorded - - - Recorded outgoing network traffic ( - bytes) send from MySQL to PHP. - The traffic may or may not have been added to the cache. The - traffic is the total for all queries regardless if cached or not. - - Since 1.0.0. - - - - send_bytes_replayed - - - Network traffic replayed during cache. This is the total amount of - outgoing traffic saved because of the usage of the query cache plugin. - - Since 1.0.0. - - - - slam_stale_refresh - - - Number of cache misses which triggered serving stale data until - the client causing the cache miss has refreshed the cache entry. - - Since 1.0.0. - - - - slam_stale_hit - - - Number of cache hits while a stale cache entry gets refreshed. - - Since 1.0.0. - - - - - + + + + + + + + + Statistic + Description + Version + + + + + + cache_hit + + + Statement is considered cacheable and cached data has been reused. + Statement is considered cacheable and a cache miss happened but + the statement got cached by someone else while we process it and thus + we can fetch the result from the refreshed cache. + + Since 1.0.0. + + + + cache_miss + + + Statement is considered cacheable... + + + + ... 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. + + + + + Since 1.0.0. + + + + cache_put + + + Statement is considered cacheable and has been added to the cache. + Take care when calculating derived statistics. Storage handler + with a storage life time beyond process scope may report + cache_put = 0 together with + cache_hit > 0, if another process has filled + the cache. You may want to use + num_entries from + mysqlnd_qc_get_cache_info if the handler + supports it ( + default, + APC). + + Since 1.0.0. + + + + query_should_cache + + + Statement is considered cacheable based on query string analysis. + The statement may or may not be added to the cache. See also + cache_put. + + Since 1.0.0. + + + + query_should_not_cache + + + Statement is considered not cacheable based on query string analysis. + + Since 1.0.0. + + + + query_not_cached + + + Statement is considered not cacheable or it is + considered cachable but the storage handler has not returned a + hash key for it. + + Since 1.0.0. + + + + query_could_cache + + + Statement is considered cacheable... + + + + ... and statement has been run without errors + + + + + ... and meta data shows at least one column in the result set + + + + The statement may or may not be in the cache already. + It may or may not be added to the cache later on. + + Since 1.0.0. + + + + query_found_in_cache + + + Statement is considered cacheable and we have found it in the cache + but we have not replayed the cached data yet and we have not send + the result set to the client yet. This is not considered + a cache hit because the client might not fetch the result or + the cached data may be faulty. + + Since 1.0.0. + + + + query_uncached_other + + + Statement is considered cacheable and it may or may not be in + the cache already but either replaying cached data has failed, + no result set is available or some other error has happened. + + + + + query_uncached_no_table + + + Statement has not been cached because the result set has at least + one column which has no table name in its meta data. An example of + such a query is + SELECT SLEEP(1). To cache those + statements you have to change default value of the PHP configuration directive + mysqlnd_qc.cache_no_table and set + mysqlnd_qc.cache_no_table = 1. Often is is not + desired to cache such statements. + + Since 1.0.0. + + + + query_uncached_use_result + + + Statement would have been cached if a buffered result set + had been used. The situation is also consiered as a cache miss and + cache_miss will be incremented as well. + + Since 1.0.0. + + + + query_aggr_run_time_cache_hit + + + Aggregated run time (ms) of all cached queries. + Cached queries are those which have incremented + cache_hit. + + Since 1.0.0. + + + + query_aggr_run_time_cache_put + + + Aggregated run time (ms) of all uncached queries that + have been put into the cache. See also + cache_put. + + Since 1.0.0. + + + + query_aggr_run_time_total + + + Aggregated run time (ms) of all uncached and cached queries + that have been inspected and executed by the query cache. + + Since 1.0.0. + + + + query_aggr_store_time_cache_hit + + + Aggregated store time (ms) of all cached queries. + Cached queries are those which have incremented + cache_hit. + + Since 1.0.0. + + + + query_aggr_store_time_cache_put + + + Aggregated store time ( + ms) of all uncached queries that + have been put into the cache. See also + cache_put. + + Since 1.0.0. + + + + query_aggr_store_time_total + + + Aggregated store time (ms) of all uncached and cached queries + that have been inspected and executed by the query cache. + + Since 1.0.0. + + + + receive_bytes_recorded + + + Recorded incoming network traffic ( + bytes) send from MySQL to PHP. + The traffic may or may not have been added to the cache. The + traffic is the total for all queries regardless if cached or not. + + Since 1.0.0. + + + + receive_bytes_replayed + + + Network traffic replayed during cache. This is the total amount of + incoming traffic saved because of the usage of the query cache plugin. + + Since 1.0.0. + + + + send_bytes_recorded + + + Recorded outgoing network traffic ( + bytes) send from MySQL to PHP. + The traffic may or may not have been added to the cache. The + traffic is the total for all queries regardless if cached or not. + + Since 1.0.0. + + + + send_bytes_replayed + + + Network traffic replayed during cache. This is the total amount of + outgoing traffic saved because of the usage of the query cache plugin. + + Since 1.0.0. + + + + slam_stale_refresh + + + Number of cache misses which triggered serving stale data until + the client causing the cache miss has refreshed the cache entry. + + Since 1.0.0. + + + + slam_stale_hit + + + Number of cache hits while a stale cache entry gets refreshed. + + Since 1.0.0. + + + + + - + &reftitle.examples; - - + + query("/*qc=on*/SELECT id FROM test"); var_dump(mysqlnd_qc_get_core_stats()); ?> ]]> - + &examples.outputs; - + @@ -462,27 +461,27 @@ array(26) { } ]]> - + - - + + - + &reftitle.seealso; - - - - Runtime configuration - - - mysqlnd_qc.collect_statistics - - - mysqlnd_qc.time_statistics - - - - + + + + Runtime configuration + + + mysqlnd_qc.collect_statistics + + + mysqlnd_qc.time_statistics + + + + diff --git a/reference/mysqlnd_qc/functions/mysqlnd-qc-get-handler.xml b/reference/mysqlnd_qc/functions/mysqlnd-qc-get-handler.xml index ca6179f864..2a55bdab71 100644 --- a/reference/mysqlnd_qc/functions/mysqlnd-qc-get-handler.xml +++ b/reference/mysqlnd_qc/functions/mysqlnd-qc-get-handler.xml @@ -2,54 +2,54 @@ - - mysqlnd_qc_get_handler - Returns a list of available storage handler - + + mysqlnd_qc_get_handler + Returns a list of available storage handler + - + &reftitle.description; - - array - mysqlnd_qc_get_handler - - - - Which storage are available depends on the compile time - configuration of the query cache plugin. The - default storage handler is always available. - All other storage handler must be enabled explicitly when building the - extension. - + + array + mysqlnd_qc_get_handler + + + + Which storage are available depends on the compile time + configuration of the query cache plugin. The + default storage handler is always available. + All other storage handler must be enabled explicitly when building the + extension. + - + - + &reftitle.parameters; &no.function.parameters; - + - + &reftitle.returnvalues; - - Returns an array of available built-in storage handler. - For each storage handler the version number and version string - is given. - - + + Returns an array of available built-in storage handler. + For each storage handler the version number and version string + is given. + + - - &reftitle.examples; - - + + &reftitle.examples; + + ]]> - + &examples.outputs; - + @@ -89,24 +89,26 @@ array(5) { } } ]]> - + - - + + &reftitle.seealso; - - - - Installation - - - mysqlnd_qc_change_handler - - - - + + + + Installation + + + + mysqlnd_qc_change_handler + + + + + diff --git a/reference/mysqlnd_qc/functions/mysqlnd-qc-get-query-trace-log.xml b/reference/mysqlnd_qc/functions/mysqlnd-qc-get-query-trace-log.xml index c81bb59211..2d4b86d3ab 100644 --- a/reference/mysqlnd_qc/functions/mysqlnd-qc-get-query-trace-log.xml +++ b/reference/mysqlnd_qc/functions/mysqlnd-qc-get-query-trace-log.xml @@ -2,155 +2,155 @@ - - mysqlnd_qc_get_query_trace_log - Returns a backtrace for each query inspected by the query cache - + + mysqlnd_qc_get_query_trace_log + Returns a backtrace for each query inspected by the query cache + - + &reftitle.description; - - array - mysqlnd_qc_get_query_trace_log - - - - Returns a backtrace for each query inspected by the query cache. - The collection of the backtrace is disabled by default. To collect - the backtrace you have to set the PHP configuration directive - mysqlnd_qc.collect_query_trace to - 1 - - - The maximum depth of the backtrace is limited to the depth set - with the PHP configuration directive - mysqlnd_qc.query_trace_bt_depth. - + + array + mysqlnd_qc_get_query_trace_log + + + + Returns a backtrace for each query inspected by the query cache. + The collection of the backtrace is disabled by default. To collect + the backtrace you have to set the PHP configuration directive + mysqlnd_qc.collect_query_trace to + 1 + + + The maximum depth of the backtrace is limited to the depth set + with the PHP configuration directive + mysqlnd_qc.query_trace_bt_depth. + - + - + &reftitle.parameters; &no.function.parameters; - + - + &reftitle.returnvalues; - - An array of query backtrace. Every list entry contains - the query string, a backtrace and further detail information. - + + An array of query backtrace. Every list entry contains + the query string, a backtrace and further detail information. + - - - - - - - Key - Description - - - - - - query - - + + + + + + + Key + Description + + + + + + query + + Query string. - - - - - origin - - - Code backtrace. - - - - - run_time - - - Query run time in milliseconds. The collection of - of all times and the necessary - gettimeofday - system calls can be disabled by setting the PHP configuration - directive - mysqlnd_qc.time_statistics to - 0 - - - - - store_time - - - Query result set store time in milliseconds. The collection of - of all times and the necessary - gettimeofday - system calls can be disabled by setting the PHP configuration - directive - mysqlnd_qc.time_statistics to - 0 - - - - - eligible_for_caching - - - TRUE if query is cacheble otherwise - FALSE. - - - - - no_table - - - TRUE if the query has generated a result - set and at least one column from the result set has no table - name set in its metadata. This is usually the case with - queries which one probably do not want to cache such as - SELECT SLEEP(1). By default any such query - will not be added to the cache. See also PHP configuration directive - mysqlnd_qc.cache_no_table. - - - - - was_added - - - TRUE if the query result has been put into - the cache, otherwise - FALSE. - - - - - was_already_in_cache - - - TRUE if the query result would have been - added to the cache if it was not already in the cache (cache hit). - Otherwise - FALSE. - - + + + + + origin + + + Code backtrace. + + + + + run_time + + + Query run time in milliseconds. The collection of + of all times and the necessary + gettimeofday + system calls can be disabled by setting the PHP configuration + directive + mysqlnd_qc.time_statistics to + 0 + + + + + store_time + + + Query result set store time in milliseconds. The collection of + of all times and the necessary + gettimeofday + system calls can be disabled by setting the PHP configuration + directive + mysqlnd_qc.time_statistics to + 0 + + + + + eligible_for_caching + + + TRUE if query is cacheble otherwise + FALSE. + + + + + no_table + + + TRUE if the query has generated a result + set and at least one column from the result set has no table + name set in its metadata. This is usually the case with + queries which one probably do not want to cache such as + SELECT SLEEP(1). By default any such query + will not be added to the cache. See also PHP configuration directive + mysqlnd_qc.cache_no_table. + + + + + was_added + + + TRUE if the query result has been put into + the cache, otherwise + FALSE. + + + + + was_already_in_cache + + + TRUE if the query result would have been + added to the cache if it was not already in the cache (cache hit). + Otherwise + FALSE. + + - - - - + + + + - + &reftitle.examples; - - + + fetch_assoc()); $res->free(); ?> ]]> - + &examples.outputs; - + @@ -311,33 +311,33 @@ array(6) { } } ]]> - + - - + + - + &reftitle.seealso; - - - - Runtime configuration - - - mysqlnd_qc.collect_query_trace - - - mysqlnd_qc.query_trace_bt_depth - - - mysqlnd_qc.time_statistics - - - mysqlnd_qc.cache_no_table - - - - + + + + Runtime configuration + + + mysqlnd_qc.collect_query_trace + + + mysqlnd_qc.query_trace_bt_depth + + + mysqlnd_qc.time_statistics + + + mysqlnd_qc.cache_no_table + + + + diff --git a/reference/mysqlnd_qc/functions/mysqlnd-qc-set-user-handlers.xml b/reference/mysqlnd_qc/functions/mysqlnd-qc-set-user-handlers.xml index 578bb87cb6..3532afc92c 100644 --- a/reference/mysqlnd_qc/functions/mysqlnd-qc-set-user-handlers.xml +++ b/reference/mysqlnd_qc/functions/mysqlnd-qc-set-user-handlers.xml @@ -2,168 +2,168 @@ - - mysqlnd_qc_set_user_handlers - Sets the callback functions for a user-defined procedural storage handler - + + mysqlnd_qc_set_user_handlers + Sets the callback functions for a user-defined procedural storage handler + - + &reftitle.description; - - bool - mysqlnd_qc_set_user_handlers - - string - get_hash - - - string - find_query_in_cache - - - string - return_to_cache - - - string - add_query_to_cache_if_not_exists - - - string - query_is_select - - - string - update_query_run_time_stats - - - string - get_stats - - - string - clear_cache - - - - Sets the callback functions for a user-defined procedural storage handler. - + + bool + mysqlnd_qc_set_user_handlers + + string + get_hash + + + string + find_query_in_cache + + + string + return_to_cache + + + string + add_query_to_cache_if_not_exists + + + string + query_is_select + + + string + update_query_run_time_stats + + + string + get_stats + + + string + clear_cache + + + + Sets the callback functions for a user-defined procedural storage handler. + - - - + + + &reftitle.parameters; - - - - get_hash - - - + + + + get_hash + + + Name of the user function implementing the storage handler - get_hash functionality. - - - - - - find_query_in_cache - - - + get_hash functionality. + + + + + + find_query_in_cache + + + Name of the user function implementing the storage handler - find_in_cache functionality. - - - - - - return_to_cache - - - + find_in_cache functionality. + + + + + + return_to_cache + + + Name of the user function implementing the storage handler - return_to_cache functionality. - - - - - - add_query_to_cache_if_not_exists - - - + return_to_cache functionality. + + + + + + add_query_to_cache_if_not_exists + + + Name of the user function implementing the storage handler - add_query_to_cache_if_not_exists functionality. - - - - - - query_is_select - - - + add_query_to_cache_if_not_exists functionality. + + + + + + query_is_select + + + Name of the user function implementing the storage handler - query_is_select functionality. - - - - - - update_query_run_time_stats - - - + query_is_select functionality. + + + + + + update_query_run_time_stats + + + Name of the user function implementing the storage handler - update_query_run_time_stats functionality. - - - - - - get_stats - - - + update_query_run_time_stats functionality. + + + + + + get_stats + + + Name of the user function implementing the storage handler - get_stats functionality. - - - - - - clear_cache - - - + get_stats functionality. + + + + + + clear_cache + + + Name of the user function implementing the storage handler - clear_cache functionality. - - - - - + clear_cache functionality. + + + + + - + &reftitle.returnvalues; - - Returns TRUE on success or FALSE on FAILURE. - - - - + + Returns TRUE on success or FALSE on FAILURE. + + + + &reftitle.seealso; - - - - Procedural user-defined storage handler example - - - - + + + + Procedural user-defined storage handler example + + + + diff --git a/reference/mysqlnd_qc/ini.xml b/reference/mysqlnd_qc/ini.xml index 530743d229..7f09eea115 100644 --- a/reference/mysqlnd_qc/ini.xml +++ b/reference/mysqlnd_qc/ini.xml @@ -4,382 +4,382 @@
&reftitle.runtime; &extension.runtime; - - - mysqlnd_qc &ConfigureOptions; - - - - &Name; - &Default; - &Changeable; - &Changelog; - - - - - mysqlnd_qc.enable_qc - 1 - PHP_INI_SYSTEM - - - - - mysqlnd_qc.ttl - 30 - PHP_INI_ALL - - - - - mysqlnd_qc.cache_by_default - 0 - PHP_INI_ALL - - - - - mysqlnd_qc.cache_no_table - 0 - PHP_INI_ALL - - - - - mysqlnd_qc.use_request_time - 0 - PHP_INI_ALL - - - - - mysqlnd_qc.time_statistics - 1 - PHP_INI_ALL - - - - - mysqlnd_qc.collect_statistics - 0 - PHP_INI_ALL - - - - - mysqlnd_qc.collect_query_trace - 0 - PHP_INI_SYSTEM - - - - - mysqlnd_qc.query_trace_bt_depth - 3 - PHP_INI_SYSTEM - - - - - mysqlnd_qc.slam_defense - 0 - PHP_INI_SYSTEM - - - - - mysqlnd_qc.slam_defense_ttl - 30 - PHP_INI_SYSTEM - - - - - mysqlnd_qc.collect_normalized_query_trace - 0 - PHP_INI_SYSTEM - - - - - mysqlnd_qc.std_data_copy - 0 - PHP_INI_SYSTEM - - - - - mysqlnd_qc.apc_prefix - qc_ - PHP_INI_ALL - - - - - mysqlnd_qc.memc_server - 127.0.0.1 - PHP_INI_ALL - - - - - mysqlnd_qc.memc_port - 11211 - PHP_INI_ALL - - - - - mysqlnd_qc.sqlite_data_file - :memory: - PHP_INI_ALL - - - - - -
-
+ + + mysqlnd_qc &ConfigureOptions; + + + + &Name; + &Default; + &Changeable; + &Changelog; + + + + + mysqlnd_qc.enable_qc + 1 + PHP_INI_SYSTEM + + + + + mysqlnd_qc.ttl + 30 + PHP_INI_ALL + + + + + mysqlnd_qc.cache_by_default + 0 + PHP_INI_ALL + + + + + mysqlnd_qc.cache_no_table + 0 + PHP_INI_ALL + + + + + mysqlnd_qc.use_request_time + 0 + PHP_INI_ALL + + + + + mysqlnd_qc.time_statistics + 1 + PHP_INI_ALL + + + + + mysqlnd_qc.collect_statistics + 0 + PHP_INI_ALL + + + + + mysqlnd_qc.collect_query_trace + 0 + PHP_INI_SYSTEM + + + + + mysqlnd_qc.query_trace_bt_depth + 3 + PHP_INI_SYSTEM + + + + + mysqlnd_qc.slam_defense + 0 + PHP_INI_SYSTEM + + + + + mysqlnd_qc.slam_defense_ttl + 30 + PHP_INI_SYSTEM + + + + + mysqlnd_qc.collect_normalized_query_trace + 0 + PHP_INI_SYSTEM + + + + + mysqlnd_qc.std_data_copy + 0 + PHP_INI_SYSTEM + + + + + mysqlnd_qc.apc_prefix + qc_ + PHP_INI_ALL + + + + + mysqlnd_qc.memc_server + 127.0.0.1 + PHP_INI_ALL + + + + + mysqlnd_qc.memc_port + 11211 + PHP_INI_ALL + + + + + mysqlnd_qc.sqlite_data_file + :memory: + PHP_INI_ALL + + + + + +
+
&ini.descriptions.title; - - - - - mysqlnd_qc.enable_qc - integer - - - - Enables or disables the plugin. If disabled the extension will not plug - into - mysqlnd to proxy internal - mysqlnd C API calls. - - - - - - mysqlnd_qc.ttl - integer - - - + + + + + mysqlnd_qc.enable_qc + integer + + + + Enables or disables the plugin. If disabled the extension will not plug + into + mysqlnd to proxy internal + mysqlnd C API calls. + + + + + + mysqlnd_qc.ttl + integer + + + Default Time-to-Live (TTL) for cache entries in seconds. - - - - - - mysqlnd_qc.cache_by_default - integer - - - - Cache all queries regardless if they begin with the SQL hint that - enables caching of a query or not. Storage handler cannot overrule - the setting. It is evaluated by the core of the plugin. - - - - - - mysqlnd_qc.cache_no_table - integer - - - - Cache queries with no table name in any of columns meta data - of their result set, e.g. - SELECT SLEEP(1)? - - - - - - mysqlnd_qc.use_request_time - integer - - - - Use PHP global request time to avoid - gettimeofday() system calls? - If using - - APC - storage handler - it should be set to the value of - - apc.use_request_time - , if not - warnings will be generated. - - - - - - mysqlnd_qc.time_statistics - integer - - - - Collect run time and store time statistics using - gettimeofday() system call? Data will be - collected only if you also set - mysqlnd_qc.collect_statistics = 1, - - - - - - mysqlnd_qc.collect_statistics - integer - - - - Collect statistics for - mysqlnd_qc_get_core_stats()? - Does not influence storage handler statistics! Handler statistics - can be an integral part of the handler internal storage format. - Thereofore, collection of some handler statistics cannot be disabled. - - - - - - mysqlnd_qc.collect_query_trace - integer - - - - Collect query back traces? - - - - - - mysqlnd_qc.query_trace_bt_depth - integer - - - - Maximum depth/level of a query code backtrace. - - - - - - mysqlnd_qc.slam_defense - integer - - - - Activates handler based slam defense if available. - Supported by - Default and - - APC - storage handler - - - - - - mysqlnd_qc.slam_defense_ttl - integer - - - - TTL for stale cache entries which are - served while another client updates the entries. Supported by - - APC - - storage handler. - - - - - - mysqlnd_qc.collect_normalized_query_trace - integer - - - - Collect aggregated normalized query traces? The setting - has no effect by default. You compile the extension - using the define - NORM_QUERY_TRACE_LOG to make use of the setting. - - - - - - mysqlnd_qc.std_data_copy - integer - - - - Default storage handler: copy cached wire data? - EXPERIMENTAL – use default setting! - - - - - - mysqlnd_qc.apc_prefix - string - - - - The - - APC - storage handler stores data in the - APC user cache. The setting sets a prefix to be - used for cache entries. - - - - - - mysqlnd_qc.memc_server - string - - - - MEMCACHE storage handler: memcache server host. - - - - - - mysqlnd_qc.memc_port - integer - - - - MEMCACHE storage handler: memcached server port. - - - - - - mysqlnd_qc.sqlite_data_file - string - - - - sqlite storage handler: data file. Any setting - but - :memory: may be of little practical value. - - - + + + + + + mysqlnd_qc.cache_by_default + integer + + + + Cache all queries regardless if they begin with the SQL hint that + enables caching of a query or not. Storage handler cannot overrule + the setting. It is evaluated by the core of the plugin. + + + + + + mysqlnd_qc.cache_no_table + integer + + + + Cache queries with no table name in any of columns meta data + of their result set, e.g. + SELECT SLEEP(1)? + + + + + + mysqlnd_qc.use_request_time + integer + + + + Use PHP global request time to avoid + gettimeofday() system calls? + If using + + APC + storage handler + it should be set to the value of + + apc.use_request_time + , if not + warnings will be generated. + + + + + + mysqlnd_qc.time_statistics + integer + + + + Collect run time and store time statistics using + gettimeofday() system call? Data will be + collected only if you also set + mysqlnd_qc.collect_statistics = 1, + + + + + + mysqlnd_qc.collect_statistics + integer + + + + Collect statistics for + mysqlnd_qc_get_core_stats()? + Does not influence storage handler statistics! Handler statistics + can be an integral part of the handler internal storage format. + Thereofore, collection of some handler statistics cannot be disabled. + + + + + + mysqlnd_qc.collect_query_trace + integer + + + + Collect query back traces? + + + + + + mysqlnd_qc.query_trace_bt_depth + integer + + + + Maximum depth/level of a query code backtrace. + + + + + + mysqlnd_qc.slam_defense + integer + + + + Activates handler based slam defense if available. + Supported by + Default and + + APC + storage handler + + + + + + mysqlnd_qc.slam_defense_ttl + integer + + + + TTL for stale cache entries which are + served while another client updates the entries. Supported by + + APC + + storage handler. + + + + + + mysqlnd_qc.collect_normalized_query_trace + integer + + + + Collect aggregated normalized query traces? The setting + has no effect by default. You compile the extension + using the define + NORM_QUERY_TRACE_LOG to make use of the setting. + + + + + + mysqlnd_qc.std_data_copy + integer + + + + Default storage handler: copy cached wire data? + EXPERIMENTAL – use default setting! + + + + + + mysqlnd_qc.apc_prefix + string + + + + The + + APC + storage handler stores data in the + APC user cache. The setting sets a prefix to be + used for cache entries. + + + + + + mysqlnd_qc.memc_server + string + + + + MEMCACHE storage handler: memcache server host. + + + + + + mysqlnd_qc.memc_port + integer + + + + MEMCACHE storage handler: memcached server port. + + + + + + mysqlnd_qc.sqlite_data_file + string + + + + sqlite storage handler: data file. Any setting + but + :memory: may be of little practical value. + + + - - + +