From 7a0bf3ddab09787dafcc188aa2e75d2b36d65771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Wed, 28 Nov 2012 14:56:42 +0000 Subject: [PATCH] Add mysqlnd_memcache docs git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@328533 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mysqlinfo/set.xml | 1 + reference/mysqlnd_memcache/book.xml | 150 ++++++++++ reference/mysqlnd_memcache/changes.xml | 61 ++++ reference/mysqlnd_memcache/configure.xml | 42 +++ reference/mysqlnd_memcache/constants.xml | 123 ++++++++ .../mysqlnd_memcache/figures/mymemflow.dot | 32 +++ .../mysqlnd_memcache/figures/mymemflow.png | Bin 0 -> 9414 bytes .../functions/mysqlnd-memcache-get-config.xml | 272 ++++++++++++++++++ .../functions/mysqlnd-memcache-set.xml | 175 +++++++++++ reference/mysqlnd_memcache/ini.xml | 82 ++++++ reference/mysqlnd_memcache/quickstart.xml | 187 ++++++++++++ reference/mysqlnd_memcache/reference.xml | 30 ++ reference/mysqlnd_memcache/setup.xml | 68 +++++ reference/mysqlnd_memcache/versions.xml | 33 +++ 14 files changed, 1256 insertions(+) create mode 100644 reference/mysqlnd_memcache/book.xml create mode 100644 reference/mysqlnd_memcache/changes.xml create mode 100644 reference/mysqlnd_memcache/configure.xml create mode 100644 reference/mysqlnd_memcache/constants.xml create mode 100644 reference/mysqlnd_memcache/figures/mymemflow.dot create mode 100644 reference/mysqlnd_memcache/figures/mymemflow.png create mode 100644 reference/mysqlnd_memcache/functions/mysqlnd-memcache-get-config.xml create mode 100644 reference/mysqlnd_memcache/functions/mysqlnd-memcache-set.xml create mode 100644 reference/mysqlnd_memcache/ini.xml create mode 100644 reference/mysqlnd_memcache/quickstart.xml create mode 100644 reference/mysqlnd_memcache/reference.xml create mode 100644 reference/mysqlnd_memcache/setup.xml create mode 100644 reference/mysqlnd_memcache/versions.xml diff --git a/reference/mysqlinfo/set.xml b/reference/mysqlinfo/set.xml index 335e37739c..ab63bc7033 100644 --- a/reference/mysqlinfo/set.xml +++ b/reference/mysqlinfo/set.xml @@ -503,5 +503,6 @@ $ ./configure --with-mysqli=/path/to/mysql_config --with-pdo-mysql=/path/to/mysq &reference.mysqlnd-qc.book; &reference.mysqlnd-uh.book; &reference.mysqlnd-mux.book; + &reference.mysqlnd-memcache.book; diff --git a/reference/mysqlnd_memcache/book.xml b/reference/mysqlnd_memcache/book.xml new file mode 100644 index 0000000000..0c3d8d3273 --- /dev/null +++ b/reference/mysqlnd_memcache/book.xml @@ -0,0 +1,150 @@ + + + + + Mysqlnd Memache plugin + mysqlnd_memcache + + + &reftitle.intro; + + The mysqlnd memcache plugin (mysqlnd_memcache) is an PHP + extension for transparently translating SQL into requests for the + MySQL InnoDB Memcached Daemon Plugin (server plugin). It includes + experimental support for the MySQL Cluster Memcached Daemon. The server + plugin provides access to data stored inside MySQL InnoDB (respectively + MySQL Cluster NDB) tables using the Memcache protocol. + This PHP extension, which supports all PHP MySQL extensions that use + mysqlnd, will identify tables exported in + this way and will translate specific SELECT queries into Memcache requests. + + + mysqlnd_memcache data flow + + + + + + + This plugin depends on the MySQL InnoDB Memcached Daemon Plugin. It is not + provided to be used with a stand-alone Memcached. For a generic query cache + using Memcached look at the mysqlnd query + cache plugin. For direct Memcache access look at the + memcache and + memcached extensions. + + + + The MySQL native driver for PHP is a C library that ships together with + PHP as of PHP 5.3.0. It serves as a drop-in replacement for the + MySQL Client Library (libmysql/libmysqlclient). Using mysqlnd has + several advantages: no extra downloads are required because it's bundled with PHP, + it's under the PHP license, there is lower memory consumption in certain cases, and + it contains new functionality such as asynchronous queries. + + + The mysqlnd_mmemcache operates, for the most part, + transparently from a user perspective. The mysqlnd memcache + plugin supports all PHP applications, and all MySQL PHP extensions. + It does not change existing APIs. Therefore, it can easily be used with + existing PHP applications. + + + The MySQL Memcache plugins add key-value style access method for data stored + in InnoDB resp. NDB (MySQL Cluster) SQL tables through the Memcache protocol. + This type of key-value access if often faster than using SQL. + +
+ Key Features + + The key features of PECL/mysqlnd_memcache are as follows. + + + + + + Possible performance benefits + + + + + + Client-side: light-weight protocol. + + + + + Server-side: no SQL parsing, direct access to the storage. + + + + + Please, run your own benchmarks! Actual performance results are + highly dependent on setup and hardware used. + + + + + + + +
+ +
+ Limitations + + The initial version is not binary safe. Due to the way the MySQL Memcache + plugins works there are restrictions related to separators. + + + Prepared statements and asynchronous queries are not supported. Result set + meta data support is limited. + + + The mapping information for tables accessible via Memcache is not cached + in the plugin between requests but fetched from the MySQL server each time + a MySQL connection is associated with a Memcache connection. See + mysqlnd_memcache_set for details. + +
+ +
+ On the name + + The shortcut mysqlnd_memcache + stands for mysqlnd memcache plugin. + Memcache refers to support of the MySQL Memcache plugins + for InnoDB and NDB (MySQL Cluster). The plugin is not + related to the Memcached cache server. + +
+
+ + &reference.mysqlnd-memcache.quickstart; + &reference.mysqlnd-memcache.setup; + &reference.mysqlnd-memcache.constants; + &reference.mysqlnd-memcache.reference; + &reference.mysqlnd-memcache.changes; + +
+ + diff --git a/reference/mysqlnd_memcache/changes.xml b/reference/mysqlnd_memcache/changes.xml new file mode 100644 index 0000000000..9db05cab33 --- /dev/null +++ b/reference/mysqlnd_memcache/changes.xml @@ -0,0 +1,61 @@ + + + + + Change History + + This change history is a high level summary of selected changes + that may impact applications and/or break backwards compatibility. + + + See also the CHANGES file in the source distribution + for a complete list of changes. + + +
+ PECL/mysqlnd_memcache 1.0 series + + 1.0.0-alpha + + + + Release date: TBD + + + + + Motto/theme: Basic mapping of SQL SELECT to a MySQL Memcache plugin access. + + + + + + The initial release does map basic SQL SELECT statements to a MySQL Memcache plugin + access. This bares potential performance benefits as the direct + key-value access to MySQL storage using the Memcache protocol is usually + faster than using SQL access. + +
+ +
+ + diff --git a/reference/mysqlnd_memcache/configure.xml b/reference/mysqlnd_memcache/configure.xml new file mode 100644 index 0000000000..352104f58a --- /dev/null +++ b/reference/mysqlnd_memcache/configure.xml @@ -0,0 +1,42 @@ + + + +
+ &reftitle.install; + + + &pecl.moved; + + + + &pecl.info; + &url.pecl.package;mysqlnd_memcache + + + + &pecl.windows.download; + + +
+ + + diff --git a/reference/mysqlnd_memcache/constants.xml b/reference/mysqlnd_memcache/constants.xml new file mode 100644 index 0000000000..ad8edb3e85 --- /dev/null +++ b/reference/mysqlnd_memcache/constants.xml @@ -0,0 +1,123 @@ + + + + + &reftitle.constants; + &extension.constants; + + + MySQL Memcache Plugin related + + + + + + MYSQLND_MEMCACHE_DEFAULT_REGEXP + (string) + + + + Default regular expression (pcre style) used for matching SELECT + statements that shall be mapped into a MySQL Memcache Plugin + access, if possible. + + + It is possible to use a different but the defailt regular expression for pattern + matching. See also mysqlnd_memcache_set. + + + + + + + + Assorted + + + The plugins version number can be obtained using + MYSQLND_MEMCACHE_VERSION or + MYSQLND_MEMCACHE_VERSION_ID. + MYSQLND_MEMCACHE_VERSION + is the string representation of the numerical version number + MYSQLND_MEMCACHE_VERSION_ID, which is an integer such as 10000. + Developers can calculate the version number as follows. + + + + + + + Version (part) + Example + + + + + Major*10000 + 1*10000 = 10000 + + + Minor*100 + 0*100 = 0 + + + Patch + 0 = 0 + + + MYSQLND_MEMCACHE_VERSION_ID + 10000 + + + + + + + + + + MYSQLND_MEMCACHE_VERSION + (string) + + + + Plugin version string, for example, 1.0.0-alpha. + + + + + + MYSQLND_MEMCACHE_VERSION_ID + (integer) + + + + Plugin version number, for example, 10000. + + + + + + + + + diff --git a/reference/mysqlnd_memcache/figures/mymemflow.dot b/reference/mysqlnd_memcache/figures/mymemflow.dot new file mode 100644 index 0000000000..a69de553d8 --- /dev/null +++ b/reference/mysqlnd_memcache/figures/mymemflow.dot @@ -0,0 +1,32 @@ +/* +Render using +$ dot -Tpng -ofigures/mymemflow.png figures/mymemflow.dot +*/ +graph mymemflow { + rankdir=LR + node [shape=box] + + subgraph clusterPHP { + rankdir=LR + label="PHP" + extmysql [label="ext/mysql"] + extmysql -- mysqlnd_memcache + mysqli -- mysqlnd_memcache + pdo -- mysqlnd_memcache + + subgraph clusterMysqlnd { + label=mysqlnd + mysqlnd_memcache [color=blue] + } + } + + subgraph clusterMySQL { + label="MySQL Server" + color=black + sqlengine [label="SQL Engine"] + innoplugin [label="InnoDB Memcache Daemon" color=blue] + } + + mysqlnd_memcache -- innoplugin [label="memcache protocol" color=blue] + mysqlnd_memcache -- sqlengine [label="MySQL Protocol"] +} diff --git a/reference/mysqlnd_memcache/figures/mymemflow.png b/reference/mysqlnd_memcache/figures/mymemflow.png new file mode 100644 index 0000000000000000000000000000000000000000..328d66c1387b8abdf3fda84d7d505afbf30188c8 GIT binary patch literal 9414 zcmbVy1z1$kx9>p-l>roxmJ~!f6c|YrL>lSt5P_jP6=|e9r5SQWkQho)1O{oO1Vrg( z=zg33jqiW&efNIvzB7F13}?>XXRoza{?-atRhA{XL30CwAR@Wv(rOTNl^cR^$gf=i zcaW*dcfbYTOhHx}y14wjZ!S)NAVx?|`mu&*=K55CqsCtI#r6Ry!~xutm7C;sQRmOt_v$z?m3@Mf1cVQ1G5UtfPCvuEGvQoP&da{AD^hq<^2VM z`dR)Xx!N$6c5ss4O%Dg1?SCafP;70dspB8I447?N$rUIt)zOgjzvGF? zV_GK%`0liGh1b6<;)Kc7eQ2xNJ=#?%ey`R(2-ozCh-iVe#}8NX6goQY4)HUk1i4Lw-vdKIf3XTK~g zSdCObff}=1fm|sW8MH$)Ome-ZXJ=>3q{N{K`u0{OWo3~~l29yCgpe_#wx(uyboBc! zX~%!$?f+er;>8^BASjLF<~3>hF{PecwSk7SQj8`?q!m$?S-rM@r`ZR?ffxpI#;q|k zCtqiazDaQ(8Ka(zx0d{JJ^cP#xE=ZOcQ-i*8tlHAy~dnn>hrmlTp+c9snl52 zH&Y7oYPVkW5Z3cthooRNWv_`bKUnH|w7Ijsztydbuw#yMG9<2YLwxi~xwFstN?cls z=nN>t-LE|PsSHaO3|^)a9X4;qC>KQj%D88KjJQN zoqPeQ%K_D&g<`setz2BFjd##-p_(>)^PKfV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M4`)LGLgxyq2LOUbpw~Z*8V6(nae+EH=1{Jp0E`4BhMN023;-S+P%Sr)PJ02mmK1K@6uR!zC|DGeG@L3?Rpf zD&l*?D*jk9P!xxt^S1KbuEd<2s>bUO)Fuov^#9aL5jXpH_v&k@xyK@OT9cq{01ATj zna(=uM4Ca+yt9ktnfGiY_4z}0I{{nF7ASRZCCV}+HMnRBUkMvc<;V72WcJ+XGKB(n z{}HE;yo1ErtKf=~TNvk?sqOR6&p0~Xfl{C5sdsBZa?T~(_2C@6O6WURJIAw_fBbTp zq>ET?T>rSXBv8&A0qzC+=78!oYk7_7^_J_l30xZhQbb1x2d!w#E8gM zeGXbN@PNlN^9$c}Nd*-+$`yyV!__IKx0zs2d`V;DqkH$PL9M5h_DTsq*yPmi6N%7p zrDW%8Iu^Xp^Elh8W_J@4DK}1N#>5xYCI79R1XMF&lBT$T^P>KD7&@qU!8Z^8^~*+y zEz$p%zLS6Mb@*=^Rj4X0%0%7QMBLX>G{OYT4d9qV;7{-D+a{2z2E#Yjh7 rh5)OP5;FT|mi$*S`u}Xn`FjDKZ3H7ptZozoS|B+YW$DT%CU5=^2%Xs# literal 0 HcmV?d00001 diff --git a/reference/mysqlnd_memcache/functions/mysqlnd-memcache-get-config.xml b/reference/mysqlnd_memcache/functions/mysqlnd-memcache-get-config.xml new file mode 100644 index 0000000000..e50ab3e41b --- /dev/null +++ b/reference/mysqlnd_memcache/functions/mysqlnd-memcache-get-config.xml @@ -0,0 +1,272 @@ + + + + + + mysqlnd_memcache_get_config + Returns information about the plugin configuration + + + + &reftitle.description; + + array + mysqlnd_memcache_get_config + mixedconnection + + + This function returns an array containing all the mysqlnd_memcache related + configuration attached to a MySQL connection. This includes MySQL the + Memcache object provided via mysqlnd_memcache_set + as well as the table mapping configuration which was automatically collected + from the MySQL server. + + + + + &reftitle.parameters; + + + connection + + + A handle to a MySQL server of the type + PDO_MYSQL, mysqli or + ext/mysql for which the configuration is to + be returned. + + + + + + + + &reftitle.returnvalues; + + If the connection is associated with a memcache connection an array will + be returned. Otherwise this function will return false. + + + The returned array has these elements: + + + + mysqlnd_memcache_get_config array structure + + + + Array Key + Description + + + + + memcached + + Instance of Memcached associated to this MySQL connection + by mysqlnd_memcache_set. You can use this to + change settings of the memcache connection or directly querying the + server onthis connection. + + + + pattern + + Regular expression used to match an SQL query being sent to the server. + Queries matching this pattern will be further analyzed to decide whether + the query can be intercepted and sent via the memcache interface or + whether the query is sent using the general MySQL protocol to the + server. The pattern either is the default pattern, + MYSQLND_MEMCACHE_DEFAULT_REGEXP or set via + mysqlnd_memcache_set. + + + + mappings + + An associative array with a list of all configured containers as they + were discovered by this plugin. The key for these elements is the name + of the container in the MySQL configuration. The value is described + below. The contents of this field is created by querying the MySQL + server during associting a MySQL and a memcache connection using + mysqlnd_memcache_set. + + + + mapping_query + An SQL query used during + mysqlnd_memcache_set + to identify the available containers and mappings. The result of that + query is provided in the mappings element. + + + + +
+ + Mapping entry structure + + + + Array Key + Description + + + + + prefix + + A prefix used while accessing data via memcache. With the MySQL InnoDB + Memcache Deamon plugin this usully begins with @@ and ends with a + configurable separator. This prefix is placed in front of the key value + while using the memcache protocol. + + + + schema_name + + Name of the schema (database) which contains the table being accessed. + + + + table_name + + Name of the table which contins the data accessible via memcache + protocol. + + + + id_field_name + + Name of the database field (column) with the id used as key when + accessing the table vi a memcache. Often this is the database field + having a primary key. + + + + separator + + A seprator used to split different field values. This is needed as + memcache only provides access to a single value while MySQL can map + multiple columns to this value. + + + The separator, which can be set in the MySQL Server configuration + should not be part ofany value retrieved via memcache as proper + mapping can't be guranteed. + + + + + + fields + + An array with the names of all fields availle forthis mapping. + + + + +
+
+
+ + + &reftitle.examples; + + + <function>mysqlnd_memcache_get_config</function> example + +addServer("host", 11211); +mysqlnd_memcache_set($mysqli, $memc); + +var_dump(mysqlnd_memcache_get_config($mysqli)); +?> +]]> + + &example.outputs; + + + object(Memcached)#2 (0) { + } + ["pattern"]=> + string(125) "/^\s*SELECT\s*(.+?)\s*FROM\s*`?([a-z0-9_]+)`?\s*WHERE\s*`?([a-z0-9_]+)`?\s*=\s*(?(?=["'])["']([^"']*)["']|([0-9e\.]*))\s*$/is" + ["mappings"]=> + array(1) { + ["mymem_test"]=> + array(6) { + ["prefix"]=> + string(13) "@@mymem_test." + ["schema_name"]=> + string(4) "test" + ["table_name"]=> + string(10) "mymem_test" + ["id_field_name"]=> + string(2) "id" + ["separator"]=> + string(1) "|" + ["fields"]=> + array(3) { + [0]=> + string(2) "f1" + [1]=> + string(2) "f2" + [2]=> + string(2) "f3" + } + } + } + ["mapping_query"]=> + string(209) " SELECT c.name, + CONCAT('@@', c.name, (SELECT value FROM innodb_memcache.config_options WHERE name = 'table_map_delimiter')) AS key_prefix, + c.db_schema, + c.db_table, + c.key_columns, + c.value_columns, + (SELECT value FROM innodb_memcache.config_options WHERE name = 'separator') AS sep + FROM innodb_memcache.containers c" +} +]]> + + + + + + + &reftitle.seealso; + + + + mysqlnd_memcache_set + + + + + +
+ + diff --git a/reference/mysqlnd_memcache/functions/mysqlnd-memcache-set.xml b/reference/mysqlnd_memcache/functions/mysqlnd-memcache-set.xml new file mode 100644 index 0000000000..d21bcfdbe5 --- /dev/null +++ b/reference/mysqlnd_memcache/functions/mysqlnd-memcache-set.xml @@ -0,0 +1,175 @@ + + + + + + mysqlnd_memcache_set + Associate a MySQL connection with a Memcache connection + + + + &reftitle.description; + + bool + mysqlnd_memcache_set + mixedmysql_connection + Memcachedmemcache_connection + stringpattern + callbackcallback + + + Associate mysql_connection with + memcache_connection using pattern + as decision Regexp and callback as notification + callback or unset the association of mysql_connection. + + + While associating a MySQL connection with a Memcache connection this function + will query the MySQL server for its configuration. It will automatically + detect whether the server is configured to use the InnoDB Memcache Daemon + Plugin or MySQL Cluster NDB Memcache support. It will also query the server + to automatically identify exported tables and other configuration options. + The results of this automatic configuration can be retrieved using + mysqlnd_memcache_get_config. + + + + + &reftitle.parameters; + + + mysql_connection + + + A handle to a MySQL server of the type + PDO_MYSQL, mysqli or + ext/mysql for which the configuration is to + be set. + + + + + memcache_connection + + + A Memcached instance with an + connection to the MySQL Memcache Daemon plugin. If this parameter + is ommitted mysql_connection will be unassociated + from any memcache connection. If a previous association exists it will be + replaced. + + + + + pattern + + + A regular expression in Perl Compatible + Regular Expression syntax used to identify potential + Memcache-queries. The query should have three sub patterns. The + first subpattern contains the requested field list, the second the name + of the ID column from the query and the third the requested value. If + this parameteris ommitted or set to &null; a default + pattern will be used. + + + + + callback + + + A callback which will be used whenever a query is being sent to + MySQL. The callback will receive a single &boolean; parameter + telling if a query was sent via Memcache. + + + + + + + + &reftitle.returnvalues; + + If the association or disassociation succeds the function returns &true;. In + case of an error &false; is being returned. + + + + + &reftitle.examples; + + + + <function>mysqlnd_memcache_set</function> example with + <function>var_dump</function> as simple debugging callabck. + + +addServer("host", 11211); +mysqlnd_memcache_set($mysqli, $memc, NULL, 'var_dump'); + +/* This query will be intercepted and executed via Memcache protocol */ +echo "Sending query for id via Memcache: "; +$mysqli->query("SELECT f1, f2, f3 FROM test WHERE id = 1"); + +/* f1 is not configured as valid key field, this won't be sent via Memcache */ +echo "Sending query for f1 via Memcache: "; +$mysqli->query("SELECT id FROM test WHERE f1 = 1"); + +mysqlnd_memcache_set($mysqli); + +/* Now the regular MySQL protocol will be used */ +echo "var_dump won't be invoked: "; +$mysqli->query("SELECT f1, f2, f3 WHERE id = 1"); + +?> +]]> + + &example.outputs; + + + + + + + + + &reftitle.seealso; + + + + mysqlnd_memcache_get_config + + + + + + + + diff --git a/reference/mysqlnd_memcache/ini.xml b/reference/mysqlnd_memcache/ini.xml new file mode 100644 index 0000000000..cc1501d06c --- /dev/null +++ b/reference/mysqlnd_memcache/ini.xml @@ -0,0 +1,82 @@ + + + +
+ &reftitle.runtime; + &extension.runtime; + + + Mysqlnd_memcache &ConfigureOptions; + + + + &Name; + &Default; + &Changeable; + &Changelog; + + + + + mysqlnd_memcache.enable + 1 + PHP_INI_SYSTEM + + + + +
+
+ + &ini.descriptions.title; + + + + + + + mysqlnd_memcache.enable + integer + + + + Enables or disables the plugin. If disabled, the extension will not plug + into + mysqlnd to proxy internal + mysqlnd C API calls. + + + This option is mostly meant to be used by developers building this + extension static into PHP. In general users are encouraged to build + this extension as shared object and unloading it completely if not + needed. + + + + + + + + +
+ + diff --git a/reference/mysqlnd_memcache/quickstart.xml b/reference/mysqlnd_memcache/quickstart.xml new file mode 100644 index 0000000000..987b6afd73 --- /dev/null +++ b/reference/mysqlnd_memcache/quickstart.xml @@ -0,0 +1,187 @@ + + + + Quickstart and Examples + + The mysqlnd memcache plugin is easy to use. + This quickstart will demo typical use-cases, and provide practical advice on getting + started. + + + It is strongly recommended to read the reference sections in addition to the + quickstart. The quickstart tries to avoid discussing theoretical concepts + and limitations. Instead, it will link to the reference sections. It is safe + to begin with the quickstart. However, before using the plugin in mission critical + environments we urge you to read additionally the background information from the + reference sections. + +
+ Setup + + The plugin is implemented as a PHP extension. See also the + installation instructions to + install the + mysqlnd_memcache extension. + + + Compile or configure the PHP MySQL extension (API) (mysqli, + PDO_MYSQL, + mysql) that you plan to use with support + for the mysqlnd library. mysqlnd_memcache + is a plugin for the mysqlnd library. To use the plugin with any of the PHP + MySQL extensions, the extension has to use the mysqlnd library. + + + The mysqlnd_memcche PHP extension depends on the + memcached extension. Refer to the + according installation + instructions for installing that module. + + + Then, load this extension into PHP and activate the plugin in the PHP configuration + file using the PHP configuration directive named + mysqlnd_memcache.enable. + + + + Enabling the plugin (php.ini) + + + + + + + Follow the instructions given in the MySQL Reference Manual on installing + the Memcache plugins for the MySQL server. Activate the plugins and + configure the Memcache access to SQL tables. + + + For all future examples it is assumed that you have created a SQL table + like the following and configured Memcache access to it. + + + + SQL table used for the Quickstart + + + + + +
+
+ Usage + + After associating a MySQL connection with a Memcache connection using + mysqnd_memcache_set the plugin attempts to transparently + replace SQL SELECT + statements by a memcache access. For that purpose the plugin monitors + all SQL statements executed and tries to match the statement string + against MYSQLND_MEMCACHE_DEFAULT_REGEXP. + In case of a match, the mysqlnd memcache plugin checks whether the + SELECT is accessing only columns of a mapped table and + the WHERE clause is limited to a single key lookup. + + + In case of the example SQL table, the plugin will use the Memcache interface + of the MySQL server to fetch results for a SQL query like + SELECT f1, f2, f3 WHERE id = n. + + + + + Basic example. + + +addServer("host", 11211); +mysqlnd_memcache_set($mysqli, $memc); + +/* + This is a query which queries table test using id as key in the WHERE part + and is accessing fields f1, f2 and f3. Therefore mysqlnd_memcache + will intercept it and route it ia memcache. +*/ +$result = $mysqli->query("SELECT f1, f2, f3 FROM test WHERE id = 1"); +while ($row = $result->fetch_row()) { + print_r($row); +} + +/* + This is a query which queries table test but using f1 in the WHERE clause. + Therefore mysqlnd_memcache can't intercept it. This will be executed + using the MySQL protocol +*/ +$mysqli->query("SELECT id FROM test WHERE f1 = 'Lady'"); +while ($row = $result->fetch_row()) { + print_r($row); +} +?> +]]> + + &example.outputs; + + Hello + [f2] => World + [f3] => ! +) +array( + [id] => 2 +) +]]> + + + + +
+ +
+ diff --git a/reference/mysqlnd_memcache/reference.xml b/reference/mysqlnd_memcache/reference.xml new file mode 100644 index 0000000000..1b7a6600a3 --- /dev/null +++ b/reference/mysqlnd_memcache/reference.xml @@ -0,0 +1,30 @@ + + + + + Mysqlnd_memcache &Functions; + + &reference.mysqlnd-memcache.entities.functions; + + + + diff --git a/reference/mysqlnd_memcache/setup.xml b/reference/mysqlnd_memcache/setup.xml new file mode 100644 index 0000000000..01f6b4369d --- /dev/null +++ b/reference/mysqlnd_memcache/setup.xml @@ -0,0 +1,68 @@ + + + + + &reftitle.setup; + +
+ &reftitle.required; + + This extension requires PHP 5.4.4 or newer. + + + For accessing InnoDB tables this PHP extension requires + MySQL Server 5.6.6 or newer with the InnoDB Memcache + Daemon Plugin. + + + For accessing MySQL Cluster NDB tables this PHP extensions + requires MySQL Cluster 7.2 or newer with configured NDB + Memcache API nodes. + + + PHP must be compiled with support for Perl regular + expressions through the pcre extension. + PCRE is included into PHP by default. + + + The memcached extension 2.0.x + must be loaded into PHP. + + + The mysqlnd_memcache memcache + plugin supports all PHP applications and all available PHP MySQL extensions + (mysqli, + mysql, + PDO_MYSQL). + The PHP MySQL extension must be configured to use + mysqlnd in order to be able + to use the mysqlnd_memcache plugin for + mysqlnd. + +
+ + &reference.mysqlnd-memcache.configure; + &reference.mysqlnd-memcache.ini; + +
+ + diff --git a/reference/mysqlnd_memcache/versions.xml b/reference/mysqlnd_memcache/versions.xml new file mode 100644 index 0000000000..2e5774d723 --- /dev/null +++ b/reference/mysqlnd_memcache/versions.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + +