Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 6593

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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>Releases an exclusive lock on a given key</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.wincache-ucache-set.html">wincache_ucache_set</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="wincache.win32build.html">Building for Windows</a></div>
 <div class="up"><a href="ref.wincache.html">WinCache Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.wincache-unlock" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">wincache_unlock</h1>
  <p class="verinfo">(PECL wincache &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">wincache_unlock</span> &mdash; <span class="dc-title">
   Releases an exclusive lock on a given key
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.wincache-unlock-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>wincache_unlock</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$key</code></span>
   )</div>

  <p class="para rdfs-comment">
   Releases an exclusive lock that was obtained on a given key by using  <span class="function"><a href="function.wincache-lock.html" class="function">wincache_lock()</a></span>. 
   If any other process was blocked waiting for the lock on this key, that process will be able to obtain 
   the lock.
  </p>
  <div class="warning"><strong class="warning">Warning</strong>
   <p class="simpara">
    Using of the  <span class="function"><a href="function.wincache-lock.html" class="function">wincache_lock()</a></span> and  <span class="function"><strong>wincache_unlock()</strong></span> can cause deadlocks when 
    executing PHP scripts in a multi-process environment like FastCGI. Do not use these functions unless you are 
    absolutely sure you need to use them. For the majority of the operations on the user cache it is not necessary to
    use these functions.
   </p>
  </div>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.wincache-unlock-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">key</code></em></span>
     <dd>

      <p class="para">
       Name of the key in the cache to release the lock on.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.wincache-unlock-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>
 </div>

 <div class="refsect1 examples" id="refsect1-function.wincache-unlock-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-585">
    <p><strong>Example #1 Using  <span class="function"><strong>wincache_unlock()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">"/tmp/lock.txt"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"r+"</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">wincache_lock</span><span style="color: #007700">(</span><span style="color: #0000BB">“lock_txt_lock”</span><span style="color: #007700">))&nbsp;{&nbsp;</span><span style="color: #FF8000">//&nbsp;do&nbsp;an&nbsp;exclusive&nbsp;lock<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ftruncate</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;truncate&nbsp;file<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Write&nbsp;something&nbsp;here\n"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">wincache_unlock</span><span style="color: #007700">(</span><span style="color: #0000BB">“lock_txt_lock”</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;release&nbsp;the&nbsp;lock<br /></span><span style="color: #007700">}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Couldn't&nbsp;get&nbsp;the&nbsp;lock!"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.wincache-unlock-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.wincache-lock.html" class="function" rel="rdfs-seeAlso">wincache_lock()</a> - Acquires an exclusive lock on a given key</span></li>
    <li class="member"> <span class="function"><a href="function.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="function.wincache-ucache-get.html" class="function" rel="rdfs-seeAlso">wincache_ucache_get()</a> - Gets a variable stored in the user cache</span></li>
    <li class="member"> <span class="function"><a href="function.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="function.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="function.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="function.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="function.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"> <span class="function"><a href="function.wincache-scache-info.html" class="function" rel="rdfs-seeAlso">wincache_scache_info()</a> - Retrieves information about files cached in the session cache</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.wincache-ucache-set.html">wincache_ucache_set</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="wincache.win32build.html">Building for Windows</a></div>
 <div class="up"><a href="ref.wincache.html">WinCache Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>