Oracle 5.0 Reference Manual page 2703

Table of Contents

Advertisement

Mysqlnd query result cache plugin (mysqlnd_qc)
printf("MYSQLND_QC_TTL_SWITCH: %s\n", MYSQLND_QC_TTL_SWITCH);
?>
The above examples will output:
MYSQLND_QC_ENABLE_SWITCH: qc=on
MYSQLND_QC_DISABLE_SWITCH: qc=off
MYSQLND_QC_TTL_SWITCH: qc_ttl=
MYSQLND_QC_ENABLE_SWITCH
(string)
MYSQLND_QC_DISABLE_SWITCH
(string)
MYSQLND_QC_TTL_SWITCH
(string)
MYSQLND_QC_SERVER_ID_SWITCH
(string)
mysqlnd_qc_set_cache_condition
Example 20.320. Example
The function
mysqlnd_qc_set_cache_condition
of statements which don't begin with the SQL hints necessary to manually enable caching.
<?php
/* Cache all accesses to tables with the name "new%" in schema/database "db_example" for 1 second */
if (!mysqlnd_qc_set_cache_condition(MYSQLND_QC_CONDITION_META_SCHEMA_PATTERN, "db_example.new%", 1)) {
die("Failed to set cache condition!");
}
$mysqli = new mysqli("host", "user", "password", "db_example", "port");
/* cached although no SQL hint given
$mysqli->query("SELECT id, title FROM news");
$pdo_mysql = new PDO("mysql:host=host;dbname=db_example;port=port", "user", "password");
/* not cached: no SQL hint, no pattern match */
$pdo_mysql->query("SELECT id, title FROM latest_news");
/* cached: TTL 1 second, pattern match */
SQL hint used to enable caching of a query.
SQL hint used to disable caching of a query if
mysqlnd_qc.cache_by_default =
SQL hint used to set the TTL of a result set.
This SQL hint should not be used in general.
It is needed by
PECL/mysqlnd_ms
statement but originating from different physical connections. If
the hint is used connection settings such as user, hostname and
charset are not considered for generating a cache key of a query.
Instead the given value and the query string are used as input to the
hashing function that generates the key.
PECL/mysqlnd_ms may, if instructed, cache results from MySQL
Replication slaves. Because it can hold many connections to the
slave the cache key shall not be formed from the user, hostname
or other settings that may vary for the various slave connections.
Instead, PECL/mysqlnd_ms provides an identifier which refers to
the group of slave connections that shall be enabled to share cache
entries no matter which physical slave connection was to generate
the cache entry.
Use of this feature outside of PECL/mysqlnd_ms is not
recommended.
related
mysqlnd_qc_set_cache_condition
*/
2683
1.
to group cache entries for one
usage
allows setting conditions for automatic caching

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents