mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Minor update: typos and a little markup/grammar
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@324475 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
9533989cdb
commit
8a08005bc7
4 changed files with 43 additions and 44 deletions
|
@ -24,7 +24,7 @@
|
|||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Motto/theme: PHP 5.4 compatbility, schema pattern based caching and mysqlnd_ms support
|
||||
Motto/theme: PHP 5.4 compatibility, schema pattern based caching and mysqlnd_ms support
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<para>
|
||||
<example>
|
||||
<para>
|
||||
The query cache is controled by SQL hints. SQL hints are used to enable and
|
||||
The query cache is controlled by SQL hints. SQL hints are used to enable and
|
||||
disable caching. SQL hints can be used to set the
|
||||
<literal>TTL</literal> of a query.
|
||||
</para>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<para>
|
||||
The query cache plugin 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
|
||||
startup of the PHP interpreter, it gets registered as a
|
||||
<link linkend="book.mysqlnd">mysqlnd</link> plugin to replace selected
|
||||
mysqlnd C methods. Hereby, it can change the behaviour of any
|
||||
PHP MySQL extension (<link linkend="ref.mysqli">mysqli</link>,
|
||||
|
@ -57,7 +57,7 @@
|
|||
A statement is either cached if the plugin is instructed to cache all
|
||||
statements globally using a or, if the query string starts with the SQL hint
|
||||
(<literal>/*qc=on*/</literal>). The plugin is capable of caching any
|
||||
query isssued by calling appropriate API calls of any of the existing
|
||||
query issued by calling appropriate API calls of any of the existing
|
||||
PHP MySQL extensions.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -130,12 +130,12 @@
|
|||
PECL/mysqlnd_qc has a unique approach to caching result sets that is superior
|
||||
to application based cache solutions. Application based solutions first fetch
|
||||
a result set into PHP variables. Then, the PHP variables are serialized for
|
||||
storing in a persistent cache and unserialized when fetching. The mysqlnd
|
||||
query cache stores the raw wire protocol data send from MySQL to PHP in its cache
|
||||
and replayes it, if still valid, on a cache hit. This way, it saves an extra
|
||||
storage in a persistent cache, and then unserialized when fetching. The mysqlnd
|
||||
query cache stores the raw wire protocol data sent from MySQL to PHP in its cache
|
||||
and replays it, if still valid, on a cache hit. This way, it saves an extra
|
||||
serialization step for a cache put that all application based solutions have to
|
||||
do. It can store the raw wire protocol data in the cache without having to
|
||||
serizalize into a PHP variable first and deserializing the PHP variable for storing
|
||||
serialize into a PHP variable first and deserializing the PHP variable for storing
|
||||
in the cache again.
|
||||
</para>
|
||||
</section>
|
||||
|
@ -210,7 +210,7 @@ mysqlnd_qc.enable_qc=1
|
|||
<para>
|
||||
A SQL hint is a SQL standards compliant
|
||||
comment. As a SQL comment it is ignored by the database. A statement is considered
|
||||
eligable for caching if it either begins with the SQL hint enabling caching
|
||||
eligible for caching if it either begins with the SQL hint enabling caching
|
||||
or it is a <literal>SELECT</literal> statement.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -223,22 +223,22 @@ mysqlnd_qc.enable_qc=1
|
|||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
not eliable for caching and not cached: <literal>INSERT INTO test(id) VALUES (1)</literal>
|
||||
not eligible for caching and not cached: <literal>INSERT INTO test(id) VALUES (1)</literal>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
not eliable for caching and not cached: <literal>SHOW ENGINES</literal>
|
||||
not eligible for caching and not cached: <literal>SHOW ENGINES</literal>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
eliable for caching but uncached: <literal>SELECT id FROM test</literal>
|
||||
eligible for caching but uncached: <literal>SELECT id FROM test</literal>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
eliable for caching and cached: <literal>/*qc=on*/SELECT id FROM test</literal>
|
||||
eligible for caching and cached: <literal>/*qc=on*/SELECT id FROM test</literal>
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
@ -281,7 +281,7 @@ printf("Total time cached query: %.6fs\n", microtime(true) - $start);
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(1) {
|
||||
|
@ -302,7 +302,7 @@ Total time cached query: 0.000098s
|
|||
If nothing else is configured, as it is the case in the quickstart example,
|
||||
the plugin will use the built-in <literal>default</literal> storage handler.
|
||||
The <literal>default</literal> storage handler uses process memory to hold a cache entry.
|
||||
Depending on the PHP deploymnet model a PHP process may serve one or more
|
||||
Depending on the PHP deployment model, a PHP process may serve one or more
|
||||
web requests. Please, consult the web server manual for details.
|
||||
Details make no difference for the examples given in the quickstart.
|
||||
</para>
|
||||
|
@ -419,7 +419,7 @@ for ($i = 0; $i < 3; $i++) {
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(2) {
|
||||
|
@ -492,7 +492,7 @@ for ($i = 0; $i < 3; $i++) {
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(2) {
|
||||
|
@ -596,7 +596,7 @@ for ($i = 0; $i < 7; $i++) {
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Wall time 14:55:59 - DB row time 2012-01-11 14:55:59
|
||||
|
@ -618,8 +618,8 @@ Wall time 14:56:05 - DB row time 2012-01-11 14:56:05
|
|||
with stale data.
|
||||
</para>
|
||||
<para>
|
||||
User-defined cache storage handler can implement any invalidation strategy
|
||||
to work around this limitation. Please, find more on this below.
|
||||
A user-defined cache storage handler can implement any invalidation strategy
|
||||
to work around this limitation.
|
||||
</para>
|
||||
<para>
|
||||
The default <literal>TTL</literal> can be overruled using the SQL hint
|
||||
|
@ -671,7 +671,7 @@ printf("Script runtime\t: %d seconds\n", microtime(true) - $start);
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Default TTL : 30 seconds
|
||||
|
@ -698,10 +698,10 @@ Script runtime : 3 seconds
|
|||
An application has three options for telling PECL/mysqlnd_qc whether a particular
|
||||
statement shall be used. The most basic approach is to cache all statements by
|
||||
setting <literal><link linkend="mysqlnd-qc.configuration">
|
||||
mysqlnd_qc.cache_by_default = 1</link></literal>. This apporach is often of little
|
||||
mysqlnd_qc.cache_by_default = 1</link></literal>. This approach is often of little
|
||||
practical value. But it enables users to make a quick estimation about
|
||||
the maximum performance gains from caching. An application designed to
|
||||
use a cache may able to prefix selected statements with the appropriate SQL
|
||||
use a cache may be able to prefix selected statements with the appropriate SQL
|
||||
hints. However, altering an applications source code may not always be possible
|
||||
or desired, for example, to avoid problems with software updates. Therefore,
|
||||
PECL/mysqlnd_qc allows setting a callback which decides if a query is to be
|
||||
|
@ -711,12 +711,12 @@ Script runtime : 3 seconds
|
|||
The callback is installed with the <function>mysqlnd_qc_set_is_select</function>
|
||||
function. The callback is given the statement string of every statement
|
||||
inspected by the plugin. Then, the callback can decide whether to cache
|
||||
the function. The callback is supposed to return <literal>FALSE</literal>
|
||||
if the statement shall not be cached. A return value of <literal>TRUE</literal>
|
||||
the function. The callback is supposed to return &false;
|
||||
if the statement shall not be cached. A return value of &true;
|
||||
makes the plugin try to add the statement into the cache. The cache entry
|
||||
will be given the default TTL (<literal><link linkend="mysqlnd-qc.configuration">
|
||||
mysqlnd_qc.ttl</link></literal>). If the callback returns
|
||||
a numberical value it is used as the TTL instead of the global default.
|
||||
a numerical value it is used as the TTL instead of the global default.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
|
@ -770,7 +770,7 @@ printf("Cache hit: %d\n", $stats['cache_hit']);
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
is_select( DROP TABLE IF EXISTS test): do not cache
|
||||
|
@ -787,7 +787,7 @@ Cache hit: 1
|
|||
</para>
|
||||
<para>
|
||||
The examples callback tests if a statement string matches a pattern.
|
||||
If this is the case, it either returns <literal>TRUE</literal> to cache
|
||||
If this is the case, it either returns &true; to cache
|
||||
the statement using the global default TTL or an alternative TTL.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -1004,7 +1004,7 @@ foreach ($summary as $query => $details) {
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
DROP TABLE IF EXISTS test: 0ms (1x)
|
||||
|
@ -1030,7 +1030,7 @@ foreach ($summary as $query => $details) {
|
|||
gives storage handler specific information which includes a list
|
||||
of all cached items, depending on the storage handler. Additionally, the
|
||||
core of PECL/mysqlnd_qc collects high-level summary statistics aggregated
|
||||
per PHP process. The high-level satistics are returned by
|
||||
per PHP process. The high-level statistics are returned by
|
||||
<function>mysqlnd_qc_get_core_stats</function>.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -1038,16 +1038,15 @@ foreach ($summary as $query => $details) {
|
|||
<function>mysqlnd_qc_get_normalized_query_trace_log</function>
|
||||
and
|
||||
<function>mysqlnd_qc_get_core_stats</function>
|
||||
will not collect data unless, data collection has been
|
||||
enabled through their corresponding PHP configuration directives. Please,
|
||||
find the names of the configuration directives in the examples. Data collection
|
||||
is disabled by default for performance considerations. It has been made
|
||||
configurable through <link linkend="ini.mysqlnd-qc.time-statistics">
|
||||
<literal>mysqlnd_qc.time_statistics</literal></link> whether to collect timing
|
||||
information or not. Collection of time statistics is enabled by default
|
||||
but only performed, if data collection as such has been enabled.
|
||||
will not collect data unless data collection has been
|
||||
enabled through their corresponding PHP configuration directives. Data collection
|
||||
is disabled by default for performance considerations. It is configurable with the
|
||||
<link linkend="ini.mysqlnd-qc.time-statistics">>mysqlnd_qc.time_statistics</link>
|
||||
option, which determines if timing information should be collected.
|
||||
Collection of time statistics is enabled by default
|
||||
but only performed if data collection as such has been enabled.
|
||||
Recording time statistics causes extra system calls. In most cases,
|
||||
the benefit of the monitoring outweights any potential performance penalty of
|
||||
the benefit of the monitoring outweighs any potential performance penalty of
|
||||
the additional system calls.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -1080,7 +1079,7 @@ var_dump(mysqlnd_qc_get_core_stats());
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(26) {
|
||||
|
@ -1182,7 +1181,7 @@ var_dump(mysqlnd_qc_get_cache_info());
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(4) {
|
||||
|
@ -1346,7 +1345,7 @@ var_dump(mysqlnd_qc_get_normalized_query_trace_log());
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(4) {
|
||||
|
@ -1630,7 +1629,7 @@ $res->free();
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
query_is_select('DROP TABLE IF EXISTS test'): FALSE
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
&reftitle.required;
|
||||
<para>
|
||||
<literal>PHP 5.3.3</literal> or a newer version of <literal>PHP 5.3</literal>.
|
||||
<literal>PHP 5.4.0</literal> support is in preparation.
|
||||
<literal>PHP 5.4.0</literal> is not yet supported.
|
||||
</para>
|
||||
<para>
|
||||
PECL/mysqlnd_qc is a mysqlnd plugin. It plugs into the mysqlnd library.
|
||||
|
|
Loading…
Reference in a new issue