uTools-Manuals/docs/php/mysqlnd_qc_set_storage_handler.html
2019-04-28 19:00:34 +08:00

128 lines
5.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 class="docs"><div id="layout">
<div id="layout-content"><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 &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">mysqlnd_qc_set_storage_handler</span> &mdash; <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">说明</h3>
<div class="methodsynopsis dc-description">
<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>
) : <span class="type">bool</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="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">参数</h3>
<dl>
<dt>
<code class="parameter">handler</code>
</dt>
<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>
</dl>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.mysqlnd-qc-set-storage-handler-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
成功时返回 <strong><code>TRUE</code></strong> 或者在失败时返回 <strong><code>FALSE</code></strong>
</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">范例</h3>
<div class="example" id="example-2301">
<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"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?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&nbsp;(</span><span style="color: #0000BB">true&nbsp;</span><span style="color: #007700">===&nbsp;</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 />&nbsp;&nbsp;</span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"Default&nbsp;storage&nbsp;handler&nbsp;activated"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;Catchable&nbsp;fatal&nbsp;error&nbsp;*/<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">?&gt;</span>
</span>
</pre></div>
</div>
<div class="example-contents"><p>以上例程会输出:</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 &#039;unknown&#039; 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">参见</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="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></div></div></body></html>