Oracle 5.0 Reference Manual page 2684

Table of Contents

Advertisement

<?php
/* Connect, create and populate test table */
$mysqli = new mysqli("host", "user", "password", "schema", "port", "socket");
$mysqli->query("DROP TABLE IF EXISTS test");
$mysqli->query("CREATE TABLE test(id INT)");
$mysqli->query("INSERT INTO test(id) VALUES (1)");
for ($i = 0; $i < 3; $i++) {
$start = microtime(true);
/* Note: statement will not be cached because of NOW() use */
$res = $mysqli->query("SELECT id, NOW() AS _time FROM test");
$row = $res->fetch_assoc();
/* dump results */
var_dump($row);
printf("Total time: %.6fs\n", microtime(true) - $start);
/* pause one second */
sleep(1);
}
?>
The above examples will output something similar to:
array(2) {
["id"]=>
string(1) "1"
["_time"]=>
string(19) "2012-01-11 15:47:45"
}
Total time: 0.000546s
array(2) {
["id"]=>
string(1) "1"
["_time"]=>
string(19) "2012-01-11 15:47:45"
}
Total time: 0.000187s
array(2) {
["id"]=>
string(1) "1"
["_time"]=>
string(19) "2012-01-11 15:47:45"
}
Total time: 0.000167s
20.7.7.4.4. Setting the TTL
Copyright 1997-2012 the PHP Documentation Group. [2230]
The default invalidation strategy of the query cache plugin is Time to Live (TTL). The built-in storage
handlers will use the default
Mysqlnd query result cache plugin (mysqlnd_qc)
Note
Although
mysqlnd_qc.cache_no_table = 1
with
mysqlnd_qc.cache_by_default = 1
evaluate the
mysqlnd_qc.cache_no_table
cached, no matter whether caching has been enabled using a SQL hint or any
other measure.
defined by the PHP configuration value
TTL
2664
has been created for use
it is bound it. The plugin will
whenever a query is to be
mysqlnd_qc.ttl
unless

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents