Oracle 5.0 Reference Manual page 2680

Table of Contents

Advertisement

refreshed by the client which extended the cache entries lifespan before other clients try to refresh the
cache and potentially cause an overload situation.
Unique approach to caching
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 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 serialize into a PHP variable first and deserializing the PHP variable for storing in the cache
again.
20.7.7.4.2. Setup
Copyright 1997-2012 the PHP Documentation Group. [2230]
The plugin is implemented as a PHP extension. See also the
PECL/mysqlnd_qc
Compile or configure the PHP MySQL extension (mysqli, PDO_MYSQL, mysql) that you plan to use
with support for the
plugin with any of the existing PHP MySQL extensions (APIs), the extension has to use the mysqlnd
library.
Then, load the extension into PHP and activate the plugin in the PHP configuration file using the PHP
configuration directive named mysqlnd_qc.enable_qc.
Example 20.304. Enabling the plugin (php.ini)
mysqlnd_qc.enable_qc=1
20.7.7.4.3. Caching queries
Copyright 1997-2012 the PHP Documentation Group. [2230]
There are four ways to trigger caching of a query.
• Use of SQL hints on a per query basis
• User supplied callbacks to decide on a per query basis, for example, using
mysqlnd_qc_is_select
mysqlnd_set_cache_condition
mysqlnd_qc.cache_by_default = 1
Use of SQL hints and
to the function reference on
mysqlnd_qc_set_cache_condition
A SQL hint is a SQL standards compliant comment. As a SQL comment it is ignored by the database.
A statement is considered eligible for caching if it either begins with the SQL hint enabling caching or it
is a
SELECT
An individual query which shall be cached must begin with the SQL hint /*qc=on*/. It is
recommended to use the PHP constant
value.
• not eligible for caching and not cached:
Mysqlnd query result cache plugin (mysqlnd_qc)
extension.
mysqlnd
library. PECL/mysqlnd_qc is a plugin for the mysqlnd library. To use the
mysqlnd_qc.cache_by_default = 1
mysqlnd_qc_is_select
statement.
installation instructions
for rule based automatic per query decisions
to cache all queries blindly
for a description of using a callback and,
on how to set rules for automatic caching.
MYSQLND_QC_ENABLE_SWITCH
INSERT INTO test(id) VALUES (1)
2660
to install the
are explained below. Please, refer
instead of using the string

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents