Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 4471

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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 &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">mysqlnd_memcache_get_config</span> &mdash; <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&#039;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">&lt;?php<br />$mysqli&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">mysqli</span><span style="color: #007700">(</span><span style="color: #DD0000">"host"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"user"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"passwd"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"database"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$memc&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Memcached</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$memc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addServer</span><span style="color: #007700">(</span><span style="color: #DD0000">"host"</span><span style="color: #007700">,&nbsp;</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">,&nbsp;</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">?&gt;</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) {
  [&quot;memcached&quot;]=&gt;
  object(Memcached)#2 (0) {
  }
  [&quot;pattern&quot;]=&gt;
  string(125) &quot;/^\s*SELECT\s*(.+?)\s*FROM\s*`?([a-z0-9_]+)`?\s*WHERE\s*`?([a-z0-9_]+)`?\s*=\s*(?(?=[&quot;&#039;])[&quot;&#039;]([^&quot;&#039;]*)[&quot;&#039;]|([0-9e\.]*))\s*$/is&quot;
  [&quot;mappings&quot;]=&gt;
  array(1) {
    [&quot;mymem_test&quot;]=&gt;
    array(6) {
      [&quot;prefix&quot;]=&gt;
      string(13) &quot;@@mymem_test.&quot;
      [&quot;schema_name&quot;]=&gt;
      string(4) &quot;test&quot;
      [&quot;table_name&quot;]=&gt;
      string(10) &quot;mymem_test&quot;
      [&quot;id_field_name&quot;]=&gt;
      string(2) &quot;id&quot;
      [&quot;separator&quot;]=&gt;
      string(1) &quot;|&quot;
      [&quot;fields&quot;]=&gt;
      array(3) {
        [0]=&gt;
        string(2) &quot;f1&quot;
        [1]=&gt;
        string(2) &quot;f2&quot;
        [2]=&gt;
        string(2) &quot;f3&quot;
      }
    }
  }
  [&quot;mapping_query&quot;]=&gt;
  string(209) &quot;    SELECT c.name,
                          CONCAT(&#039;@@&#039;, c.name, (SELECT value FROM innodb_memcache.config_options WHERE name = &#039;table_map_delimiter&#039;)) AS key_prefix, 
                          c.db_schema, 
                          c.db_table, 
                          c.key_columns, 
                          c.value_columns, 
                          (SELECT value FROM innodb_memcache.config_options WHERE name = &#039;separator&#039;) AS sep 
                     FROM innodb_memcache.containers c&quot;
}
</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>