php-doc-en/reference/mysqlnd_qc/functions/mysqlnd-qc-set-storage-handler.xml
Yannick Torres 18046e0224 Fix svn keywords
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@325489 c90b9560-bf6c-de11-be94-00142212c4b1
2012-05-01 12:31:16 +00:00

138 lines
3.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.mysqlnd-qc-set-storage-handler" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>mysqlnd_qc_set_storage_handler</refname>
<refpurpose>Change current storage handler</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type>
<methodname>mysqlnd_qc_set_storage_handler</methodname>
<methodparam>
<type>string</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_available_handlers</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>
<title><function>mysqlnd_qc_set_storage_handler</function> example</title>
<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_set_storage_handler("memcache"));
if (true === mysqlnd_qc_set_storage_handler("default"))
printf("Default storage handler activated");
/* Catchable fatal error */
var_dump(mysqlnd_qc_set_storage_handler("unknown"));
?>
]]>
</programlisting>
&examples.outputs;
<screen>
<![CDATA[
bool(true)
Default storage handler activated
Catchable fatal error: mysqlnd_qc_set_storage_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>
<function>mysqlnd_qc_get_available_handlers</function>
</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
-->