<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->

<refentry xml:id="function.mysqlnd_qc_change_handler" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>mysqlnd_qc_change_handler</refname>
  <refpurpose>Change current storage handler</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>bool</type>
   <methodname>mysqlnd_qc_change_handler</methodname>
   <methodparam>
    <type>mixed</type>
    <parameter>handler</parameter>
   </methodparam>
  </methodsynopsis>
  <para>
   Sets the storage handler used by the query cache. A list of available
   storage handler can be obtained from
   <function>mysqlnd_qc_get_handler</function>.
   Which storage are available depends on the compile time
   configuration of the query cache plugin. The
   <literal>default</literal> storage handler is always available.
   All other storage handler must be enabled explicitly when building the
   extension.
  </para>

 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <variablelist>
   <varlistentry>
    <term>
     <parameter>handler</parameter>
    </term>
    <listitem>
     <para>
      Handler can be of type string representing the name of a
      built-in storage handler or an object of type
      <literal>mysqlnd_qc_handler_default</literal>.
      The names of the built-in storage handler are
      <literal>default</literal>,
      <literal>APC</literal>,
      <literal>MEMCACHE</literal>,
      <literal>sqlite</literal>.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success;
  </para>
  <para>
   If changing the storage handler fails a catchable fatal error will
   be thrown. The query cache cannot operate if the previous storage
   handler has been shutdown but no new storage handler has been installed.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <example>
   <para>
    The example shows the output from the built-in default storage handler.
    Other storage handler may report different data.
   </para>
   <programlisting role="php">
<![CDATA[
<?php
var_dump(mysqlnd_qc_change_handler("memcache"));

if (true === mysqlnd_qc_change_handler("default"))
  printf("Default storage handler activated");

/* Catchable fatal error */
var_dump(mysqlnd_qc_change_handler("unknown"));
?>
]]>
   </programlisting>
   &examples.outputs;
   <screen>
<![CDATA[
bool(true)
Default storage handler activated
Catchable fatal error: mysqlnd_qc_change_handler(): Unknown handler 'unknown' in (file) on line (line)

]]>
   </screen>

  </example>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member>
     <link linkend="mysqlnd-qc.installation">Installation</link>
    </member>
    <member>
     <link linkend="function.mysqlnd_qc_get_handler">
      <function>mysqlnd_qc_get_handler</function>
     </link>
    </member>
   </simplelist>
  </para>
 </refsect1>


</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->