uTools-Manuals/docs/php/wincache_ucache_get.html
2019-04-08 23:22:26 +08:00

147 lines
9.4 KiB
HTML

<!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>Gets a variable stored in the user cache</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.wincache-ucache-get" class="refentry">
<div class="refnamediv">
<h1 class="refname">wincache_ucache_get</h1>
<p class="verinfo">(PECL wincache &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">wincache_ucache_get</span> &mdash; <span class="dc-title">
Gets a variable stored in the user cache
</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.wincache-ucache-get-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>wincache_ucache_get</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">$key</code></span>
[, <span class="methodparam"><span class="type">bool</span> <code class="parameter reference">&$success</code></span>
] ) : <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span></div>
<p class="para rdfs-comment">
Gets a variable stored in the user cache.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.wincache-ucache-get-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">key</code></dt>
<dd>
<p class="para">
The <code class="parameter">key</code> that was used to store the variable in the cache.
<code class="parameter">key</code> is case sensitive. <code class="parameter">key</code> can be an
array of keys. In this case the return value will be an array of values of each element
in the <code class="parameter">key</code> array. If an object, or an array containing objects,
is returned, then the objects will be unserialized. See
<a href="language.oop5.magic.html#object.wakeup" class="link">__wakeup()</a> for details on unserializing objects.
</p>
</dd>
<dt>
<code class="parameter">success</code></dt>
<dd>
<p class="para">
Will be set to <strong><code>TRUE</code></strong> on success and <strong><code>FALSE</code></strong> on failure.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.wincache-ucache-get-returnvalues">
<h3 class="title">返回值</h3>
<p class="simpara">
If <code class="parameter">key</code> is a string, the function returns the value of the variable stored with that key.
The <code class="parameter">success</code> is set to <strong><code>TRUE</code></strong> on success and
to <strong><code>FALSE</code></strong> on failure.
</p>
<p class="simpara">
The <code class="parameter">key</code> is an array, the parameter <code class="parameter">success</code>
is always set to <strong><code>TRUE</code></strong>. The returned array (name =&gt; value pairs) will
contain only those name =&gt; value pairs for which the get operation in user cache was
successful. If none of the keys in the key array finds a match in the user cache
an empty array will be returned.
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.wincache-ucache-get-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-629">
<p><strong>Example #1 <span class="function"><strong>wincache_ucache_get()</strong></span> with <code class="parameter">key</code> as a string</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />wincache_ucache_add</span><span style="color: #007700">(</span><span style="color: #DD0000">'color'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'blue'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">wincache_ucache_get</span><span style="color: #007700">(</span><span style="color: #DD0000">'color'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$success</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$success</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>
string(4) &quot;blue&quot;
bool(true)
</pre></div>
</div>
</div>
</p>
<p class="para">
<div class="example" id="example-630">
<p><strong>Example #2 <span class="function"><strong>wincache_ucache_get()</strong></span> with <code class="parameter">key</code> as an array</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$array1&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">'green'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'5'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Blue'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'6'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'yellow'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'7'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'cyan'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'8'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">wincache_ucache_set</span><span style="color: #007700">(</span><span style="color: #0000BB">$array1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$array2&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">'green'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Blue'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'yellow'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'cyan'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">wincache_ucache_get</span><span style="color: #007700">(</span><span style="color: #0000BB">$array2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$success</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$success</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>
array(4) { [&quot;green&quot;]=&gt; string(1) &quot;5&quot;
[&quot;Blue&quot;]=&gt; string(1) &quot;6&quot;
[&quot;yellow&quot;]=&gt; string(1) &quot;7&quot;
[&quot;cyan&quot;]=&gt; string(1) &quot;8&quot; }
bool(true)
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.wincache-ucache-get-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="wincache_ucache_add.html" class="function" rel="rdfs-seeAlso">wincache_ucache_add()</a> - Adds a variable in user cache only if variable does not already exist in the cache</span></li>
<li class="member"><span class="function"><a href="wincache_ucache_set.html" class="function" rel="rdfs-seeAlso">wincache_ucache_set()</a> - Adds a variable in user cache and overwrites a variable if it already exists in the cache</span></li>
<li class="member"><span class="function"><a href="wincache_ucache_delete.html" class="function" rel="rdfs-seeAlso">wincache_ucache_delete()</a> - Deletes variables from the user cache</span></li>
<li class="member"><span class="function"><a href="wincache_ucache_clear.html" class="function" rel="rdfs-seeAlso">wincache_ucache_clear()</a> - Deletes entire content of the user cache</span></li>
<li class="member"><span class="function"><a href="wincache_ucache_exists.html" class="function" rel="rdfs-seeAlso">wincache_ucache_exists()</a> - Checks if a variable exists in the user cache</span></li>
<li class="member"><span class="function"><a href="wincache_ucache_meminfo.html" class="function" rel="rdfs-seeAlso">wincache_ucache_meminfo()</a> - Retrieves information about user cache memory usage</span></li>
<li class="member"><span class="function"><a href="wincache_ucache_info.html" class="function" rel="rdfs-seeAlso">wincache_ucache_info()</a> - Retrieves information about data stored in the user cache</span></li>
<li class="member"><a href="language.oop5.magic.html#object.wakeup" class="link">__wakeup()</a></li>
</ul>
</p>
</div>
</div></div></div></body></html>