<!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>Change current storage handler</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.mysqlnd-qc-set-is-select.html">mysqlnd_qc_set_is_select</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mysqlnd-qc-set-user-handlers.html">mysqlnd_qc_set_user_handlers</a></div> <div class="up"><a href="ref.mysqlnd-qc.html">mysqlnd_qc Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.mysqlnd-qc-set-storage-handler" class="refentry"> <div class="refnamediv"> <h1 class="refname">mysqlnd_qc_set_storage_handler</h1> <p class="verinfo">(PECL mysqlnd_qc >= 1.0.0)</p><p class="refpurpose"><span class="refname">mysqlnd_qc_set_storage_handler</span> — <span class="dc-title">Change current storage handler</span></p> </div> <div class="refsect1 description" id="refsect1-function.mysqlnd-qc-set-storage-handler-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>mysqlnd_qc_set_storage_handler</strong></span> ( <span class="methodparam"> <span class="type">string</span> <code class="parameter">$handler</code> </span> )</div> <p class="para rdfs-comment"> Sets the storage handler used by the query cache. A list of available storage handler can be obtained from <span class="function"><a href="function.mysqlnd-qc-get-available-handlers.html" class="function">mysqlnd_qc_get_available_handlers()</a></span>. Which storage are available depends on the compile time configuration of the query cache plugin. The <em>default</em> storage handler is always available. All other storage handler must be enabled explicitly when building the extension. </p> </div> <div class="refsect1 parameters" id="refsect1-function.mysqlnd-qc-set-storage-handler-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"> <em><code class="parameter">handler</code></em> </span> <dd> <p class="para"> Handler can be of type string representing the name of a built-in storage handler or an object of type <em>mysqlnd_qc_handler_default</em>. The names of the built-in storage handler are <em>default</em>, <em>APC</em>, <em>MEMCACHE</em>, <em>sqlite</em>. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-function.mysqlnd-qc-set-storage-handler-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure. </p> <p class="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. </p> </div> <div class="refsect1 examples" id="refsect1-function.mysqlnd-qc-set-storage-handler-examples"> <h3 class="title">Examples</h3> <div class="example" id="example-1869"> <p><strong>Example #1 <span class="function"><strong>mysqlnd_qc_set_storage_handler()</strong></span> example</strong></p> <div class="example-contents"><p> The example shows the output from the built-in default storage handler. Other storage handler may report different data. </p></div> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">mysqlnd_qc_set_storage_handler</span><span style="color: #007700">(</span><span style="color: #DD0000">"memcache"</span><span style="color: #007700">));<br /><br />if (</span><span style="color: #0000BB">true </span><span style="color: #007700">=== </span><span style="color: #0000BB">mysqlnd_qc_set_storage_handler</span><span style="color: #007700">(</span><span style="color: #DD0000">"default"</span><span style="color: #007700">))<br /> </span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"Default storage handler activated"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Catchable fatal error */<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">mysqlnd_qc_set_storage_handler</span><span style="color: #007700">(</span><span style="color: #DD0000">"unknown"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above examples will output:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> bool(true) Default storage handler activated Catchable fatal error: mysqlnd_qc_set_storage_handler(): Unknown handler 'unknown' in (file) on line (line) </pre></div> </div> </div> </div> <div class="refsect1 seealso" id="refsect1-function.mysqlnd-qc-set-storage-handler-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <a href="mysqlnd-qc.installation.html" class="link">Installation</a> </li> <li class="member"> <span class="function"><a href="function.mysqlnd-qc-get-available-handlers.html" class="function" rel="rdfs-seeAlso">mysqlnd_qc_get_available_handlers()</a> - Returns a list of available storage handler</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="function.mysqlnd-qc-set-is-select.html">mysqlnd_qc_set_is_select</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mysqlnd-qc-set-user-handlers.html">mysqlnd_qc_set_user_handlers</a></div> <div class="up"><a href="ref.mysqlnd-qc.html">mysqlnd_qc Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>