<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Returns information about the plugin configuration</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.mysqlnd-memcache.html">Mysqlnd_memcache Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mysqlnd-memcache-set.html">mysqlnd_memcache_set</a></div> <div class="up"><a href="ref.mysqlnd-memcache.html">Mysqlnd_memcache Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.mysqlnd-memcache-get-config" class="refentry"> <div class="refnamediv"> <h1 class="refname">mysqlnd_memcache_get_config</h1> <p class="verinfo">(PECL mysqlnd_memcache >= 1.0.0)</p><p class="refpurpose"><span class="refname">mysqlnd_memcache_get_config</span> — <span class="dc-title">Returns information about the plugin configuration</span></p> </div> <div class="refsect1 description" id="refsect1-function.mysqlnd-memcache-get-config-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">array</span> <span class="methodname"><strong>mysqlnd_memcache_get_config</strong></span> ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$connection</code></span> )</div> <p class="para rdfs-comment"> This function returns an array of all mysqlnd_memcache related configuration information that is attached to the MySQL connection. This includes MySQL, the Memcache object provided via <span class="function"><a href="function.mysqlnd-memcache-set.html" class="function">mysqlnd_memcache_set()</a></span>, and the table mapping configuration that was automatically collected from the MySQL Server. </p> </div> <div class="refsect1 parameters" id="refsect1-function.mysqlnd-memcache-get-config-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"><em><code class="parameter">connection</code></em></span> <dd> <p class="para"> A handle to a MySQL Server using one of the MySQL API extensions for PHP, which are <a href="ref.pdo-mysql.html" class="link">PDO_MYSQL</a>, <a href="book.mysqli.html" class="link">mysqli</a> or <a href="book.mysql.html" class="link">ext/mysql</a>. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-function.mysqlnd-memcache-get-config-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> An array of mysqlnd_memcache configuration information on success, otherwise <strong><code>FALSE</code></strong>. </p> <p class="para"> The returned array has these elements: </p> <p class="para"> <table class="doctable table"> <caption><strong> <span class="function"><strong>mysqlnd_memcache_get_config()</strong></span> array structure</strong></caption> <thead> <tr> <th>Array Key</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>memcached</td> <td> Instance of Memcached associated to this MySQL connection by <span class="methodname"><a href="function.mysqlnd-memcache-set.html" class="methodname">mysqlnd_memcache_set()</a></span>. You can use this to change settings of the memcache connection, or directly by querying the server on this connection. </td> </tr> <tr> <td>pattern</td> <td> The PCRE regular expression used to match the SQL query 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 is either the default pattern (<em>MYSQLND_MEMCACHE_DEFAULT_REGEXP</em>) or it is set via <span class="function"><a href="function.mysqlnd-memcache-set.html" class="function">mysqlnd_memcache_set()</a></span>. </td> </tr> <tr> <td>mappings</td> <td> 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 association to MySQL and a memcache connection using <span class="methodname"><a href="function.mysqlnd-memcache-set.html" class="methodname">mysqlnd_memcache_set()</a></span>. </td> </tr> <tr> <td>mapping_query</td> <td>An SQL query used during <span class="methodname"><a href="function.mysqlnd-memcache-set.html" class="methodname">mysqlnd_memcache_set()</a></span> to identify the available containers and mappings. The result of that query is provided in the mappings element. </td> </tr> </tbody> </table> <table class="doctable table"> <caption><strong>Mapping entry structure</strong></caption> <thead> <tr> <th>Array Key</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>prefix</td> <td> A prefix used while accessing data via memcache. With the MySQL InnoDB Memcache Deamon plugin, this usually begins with @@ and ends with a configurable separator. This prefix is placed in front of the key value while using the memcache protocol. </td> </tr> <tr> <td>schema_name</td> <td> Name of the schema (database) which contains the table being accessed. </td> </tr> <tr> <td>table_name</td> <td> Name of the table which contains the data accessible via memcache protocol. </td> </tr> <tr> <td>id_field_name</td> <td> Name of the database field (column) with the id used as key when accessing the table via memcache. Often this is the database field having a primary key. </td> </tr> <tr> <td>separator</td> <td> The separator used to split the different field values. This is needed as memcache only provides access to a single value while MySQL can map multiple columns to this value. <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> The separator, which can be set in the MySQL Server configuration, should not be part of any value retrieved via memcache because proper mapping can't be guaranteed. </p> </p></blockquote> </td> </tr> <tr> <td>fields</td> <td> An array with the name of all fields available for this mapping. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 examples" id="refsect1-function.mysqlnd-memcache-get-config-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-1934"> <p><strong>Example #1 <span class="function"><strong>mysqlnd_memcache_get_config()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />$mysqli </span><span style="color: #007700">= new </span><span style="color: #0000BB">mysqli</span><span style="color: #007700">(</span><span style="color: #DD0000">"host"</span><span style="color: #007700">, </span><span style="color: #DD0000">"user"</span><span style="color: #007700">, </span><span style="color: #DD0000">"passwd"</span><span style="color: #007700">, </span><span style="color: #DD0000">"database"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$memc </span><span style="color: #007700">= new </span><span style="color: #0000BB">Memcached</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$memc</span><span style="color: #007700">-></span><span style="color: #0000BB">addServer</span><span style="color: #007700">(</span><span style="color: #DD0000">"host"</span><span style="color: #007700">, </span><span style="color: #0000BB">11211</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">mysqlnd_memcache_set</span><span style="color: #007700">(</span><span style="color: #0000BB">$mysqli</span><span style="color: #007700">, </span><span style="color: #0000BB">$memc</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">mysqlnd_memcache_get_config</span><span style="color: #007700">(</span><span style="color: #0000BB">$mysqli</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> array(4) { ["memcached"]=> 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" } </pre></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.mysqlnd-memcache-get-config-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="methodname"><a href="function.mysqlnd-memcache-set.html" class="methodname" rel="rdfs-seeAlso">mysqlnd_memcache_set()</a> - Associate a MySQL connection with a Memcache connection</span> </li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.mysqlnd-memcache.html">Mysqlnd_memcache Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mysqlnd-memcache-set.html">mysqlnd_memcache_set</a></div> <div class="up"><a href="ref.mysqlnd-memcache.html">Mysqlnd_memcache Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>