<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.filesystem.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.clearstatcache.php',
    1 => 'clearstatcache',
    2 => 'L&ouml;scht den Status-Cache',
  ),
  'up' => 
  array (
    0 => 'ref.filesystem.php',
    1 => 'Dateisystem',
  ),
  'prev' => 
  array (
    0 => 'function.chown.php',
    1 => 'chown',
  ),
  'next' => 
  array (
    0 => 'function.copy.php',
    1 => 'copy',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/filesystem/functions/clearstatcache.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.clearstatcache" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">clearstatcache</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">clearstatcache</span> &mdash; <span class="dc-title">Löscht den Status-Cache</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.clearstatcache-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>clearstatcache</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$clear_realpath_cache</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code><span class="initializer"> = &quot;&quot;</span></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

  <p class="para rdfs-comment">
   Wenn <span class="function"><a href="function.stat.php" class="function">stat()</a></span>, <span class="function"><a href="function.lstat.php" class="function">lstat()</a></span> oder eine andere
   der in der nachstehenden Liste aufgeführten betroffenen Funktionen
   verwendet wird, speichert (cached) PHP die von diesen Funktionen
   zurückgegebenen Informationen temporär, um eine bessere Performance zu
   bieten. In bestimmten Fällen kann es jedoch erforderlich sein, diese
   zwischengespeicherten Informationen zu löschen. Wird z. B. dieselbe Datei
   innerhalb eines Skriptes mehrmals geprüft und wird diese Datei
   möglicherweise während der Ausführung des Skriptes gelöscht oder verändert,
   könnte es sinnvoll sein, den Status-Cache zu löschen. In solchen Fällen
   empfiehlt es sich, die von PHP über eine Datei zwischengespeicherten
   Informationen mittels <span class="function"><strong>clearstatcache()</strong></span> zu löschen.
  </p>
  <p class="para">
   Zu beachten ist auch, dass PHP die Informationen über nicht existente
   Dateien nicht zwischenspeichert. Falls also <span class="function"><a href="function.file-exists.php" class="function">file_exists()</a></span>
   für eine Datei aufgerufen wird, die nicht existiert, wird <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>
   zurückgegeben, bis sie erzeugt wird. Wenn die Datei erzeugt wurde, wird
   <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> zurückgegeben, auch wenn die Datei danach gelöscht wird.
   <span class="function"><a href="function.unlink.php" class="function">unlink()</a></span> leert den Zwischenspeicher jedoch automatisch.
  </p>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Diese Funktion speichert Informationen über bestimmte Dateinamen, weshalb
    <span class="function"><strong>clearstatcache()</strong></span> nur aufgerufen werden muss, wenn
    mehrere Operationen an demselben Dateinamen durchgeführt werden, und die
    Informationen über genau diese Datei nicht gespeichert werden sollen.
   </p>
  </p></blockquote>
  <p class="para">
   Betroffene Funktionen sind <span class="function"><a href="function.stat.php" class="function">stat()</a></span>,
   <span class="function"><a href="function.lstat.php" class="function">lstat()</a></span>,
   <span class="function"><a href="function.file-exists.php" class="function">file_exists()</a></span>,
   <span class="function"><a href="function.is-writable.php" class="function">is_writable()</a></span>,
   <span class="function"><a href="function.is-readable.php" class="function">is_readable()</a></span>,
   <span class="function"><a href="function.is-executable.php" class="function">is_executable()</a></span>,
   <span class="function"><a href="function.is-file.php" class="function">is_file()</a></span>,
   <span class="function"><a href="function.is-dir.php" class="function">is_dir()</a></span>,
   <span class="function"><a href="function.is-link.php" class="function">is_link()</a></span>,
   <span class="function"><a href="function.filectime.php" class="function">filectime()</a></span>,
   <span class="function"><a href="function.fileatime.php" class="function">fileatime()</a></span>,
   <span class="function"><a href="function.filemtime.php" class="function">filemtime()</a></span>,
   <span class="function"><a href="function.fileinode.php" class="function">fileinode()</a></span>,
   <span class="function"><a href="function.filegroup.php" class="function">filegroup()</a></span>,
   <span class="function"><a href="function.fileowner.php" class="function">fileowner()</a></span>,
   <span class="function"><a href="function.filesize.php" class="function">filesize()</a></span>,
   <span class="function"><a href="function.filetype.php" class="function">filetype()</a></span> und
   <span class="function"><a href="function.fileperms.php" class="function">fileperms()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.clearstatcache-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">clear_realpath_cache</code></dt>
     <dd>
      <p class="para">
       Ob der realpath-Zwischenspeicher <em>ebenfalls</em> geleert
       werden soll.
      </p>
     </dd>
    
    
     <dt><code class="parameter">filename</code></dt>
     <dd>
      <p class="para">
       Leere den realpath- und den Stat-Zwischenspeicher nur für einen
       bestimmten Dateinamen; wird nur genutzt, wenn
       <code class="parameter">clear_realpath_cache</code> <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> ist.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.clearstatcache-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Es wird kein Wert zurückgegeben.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.clearstatcache-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 <span class="function"><strong>clearstatcache()</strong></span>-Beispiel</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$file </span><span style="color: #007700">= </span><span style="color: #DD0000">'output_log.txt'</span><span style="color: #007700">;<br /><br />function </span><span style="color: #0000BB">get_owner</span><span style="color: #007700">(</span><span style="color: #0000BB">$file</span><span style="color: #007700">)<br />{<br />    </span><span style="color: #0000BB">$stat </span><span style="color: #007700">= </span><span style="color: #0000BB">stat</span><span style="color: #007700">(</span><span style="color: #0000BB">$file</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">$user </span><span style="color: #007700">= </span><span style="color: #0000BB">posix_getpwuid</span><span style="color: #007700">(</span><span style="color: #0000BB">$stat</span><span style="color: #007700">[</span><span style="color: #DD0000">'uid'</span><span style="color: #007700">]);<br />    return </span><span style="color: #0000BB">$user</span><span style="color: #007700">[</span><span style="color: #DD0000">'name'</span><span style="color: #007700">];<br />}<br /><br /></span><span style="color: #0000BB">$format </span><span style="color: #007700">= </span><span style="color: #DD0000">"UID @ %s: %s\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #0000BB">$format</span><span style="color: #007700">, </span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">'r'</span><span style="color: #007700">), </span><span style="color: #0000BB">get_owner</span><span style="color: #007700">(</span><span style="color: #0000BB">$file</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">chown</span><span style="color: #007700">(</span><span style="color: #0000BB">$file</span><span style="color: #007700">, </span><span style="color: #DD0000">'ross'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #0000BB">$format</span><span style="color: #007700">, </span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">'r'</span><span style="color: #007700">), </span><span style="color: #0000BB">get_owner</span><span style="color: #007700">(</span><span style="color: #0000BB">$file</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">clearstatcache</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #0000BB">$format</span><span style="color: #007700">, </span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">'r'</span><span style="color: #007700">), </span><span style="color: #0000BB">get_owner</span><span style="color: #007700">(</span><span style="color: #0000BB">$file</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt
eine ähnliche Ausgabe wie:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">UID @ Sun, 12 Oct 2008 20:48:28 +0100: root
UID @ Sun, 12 Oct 2008 20:48:28 +0100: root
UID @ Sun, 12 Oct 2008 20:48:28 +0100: ross</pre>
</div>
    </div>
   </div>
  </p>
 </div>


</div><?php manual_footer($setup); ?>