function.memcache-setcompressthreshold.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 115 行

HTML
115
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Enable automatic compression of large values</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.memcache-set.html">Memcache::set</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.memcache-setserverparams.html">Memcache::setServerParams</a></div> <div class="up"><a href="ref.memcache.html">Memcache Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.memcache-setcompressthreshold" class="refentry"> <div class="refnamediv">  <h1 class="refname">Memcache::setCompressThreshold</h1>  <p class="verinfo">(No version information available, might be only in CVS)</p><p class="refpurpose"><span class="refname">Memcache::setCompressThreshold</span> &mdash; <span class="dc-title">Enable automatic compression of large values</span></p> </div> <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">bool</span> <span class="methodname"><b><b>Memcache::setCompressThreshold</b></b></span>    ( <span class="methodparam"><span class="type">int</span> <tt class="parameter">$threshold</tt></span>   [, <span class="methodparam"><span class="type">float</span> <tt class="parameter">$min_savings</tt></span>  ] )</div>  <p class="para rdfs-comment">   <b>Memcache::setCompressThreshold()</b> enables automatic   compression of large values.   You can also use the <b>memcache_set_compress_threshold()</b> function.  </p>  <blockquote><p><b class="note">Note</b>:        This function has been added to Memcache version 2.0.0.   <br />  </p></blockquote>  </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">threshold</tt></i></span>     <dd>      <p class="para">       Controls the minimum value length before attempting to compress automatically.       </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">min_saving</tt></i></span>     <dd>      <p class="para">       Specifies the minimum amount of savings to actually store the value       compressed. The supplied value must be between 0 and 1. Default value       is 0.2 giving a minimum 20% compression savings.      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   Returns <b><tt>TRUE</tt></b> on success or <b><tt>FALSE</tt></b> on failure.  </p> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 <b>Memcache::setCompressThreshold()</b> example</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">/*&nbsp;OO&nbsp;API&nbsp;*/<br /><br /></span><span style="color: #0000BB">$memcache_obj&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Memcache</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$memcache_obj</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addServer</span><span style="color: #007700">(</span><span style="color: #DD0000">'memcache_host'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">11211</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$memcache_obj</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setCompressThreshold</span><span style="color: #007700">(</span><span style="color: #0000BB">20000</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0.2</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;procedural&nbsp;API&nbsp;*/<br /><br /></span><span style="color: #0000BB">$memcache_obj&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">memcache_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'memcache_host'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">11211</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">memcache_set_compress_threshold</span><span style="color: #007700">(</span><span style="color: #0000BB">$memcache_obj</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">20000</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0.2</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.memcache-set.html">Memcache::set</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.memcache-setserverparams.html">Memcache::setServerParams</a></div> <div class="up"><a href="ref.memcache.html">Memcache Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?