PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

copy> <chown
Last updated: Sat, 24 Mar 2007

view this page in

clearstatcache

(PHP 4, PHP 5)

clearstatcache — Vymaže cache stavu souborů

Popis

void clearstatcache ( void )

Volání systémových funkcí stat či lstat má poměrně velkou režii. Tudíž se výsledek posledního volání všech stavových funkcí (viz seznam níže) ukládá pro použití při dalším takovém volání používajícím stejný název souboru. Pokud chcete vynutit novou kontrolu stavu, např. pokud je soubor kontrolován mnohokrát a může se změnit nebo zmizet, použijte tuto funkci k uvolnění výsledků posledního volání z paměti.

Tato hodnota se cachuje pouze po dobu běhu skriptu.

Ovlivněné funkce: stat(), lstat(), file_exists(), is_writable(), is_readable(), is_executable(), is_file(), is_dir(), is_link(), filectime(), fileatime(), filemtime(), fileinode(), filegroup(), fileowner(), filesize(), filetype(), a fileperms().



add a note add a note User Contributed Notes
clearstatcache
stangelanda at gmail dot com
24-Jan-2008 03:35
It should be noted that a call to any of those functions will cache all of the file's information, not just the information that is returned.

Obviously it is clear that the following requires you to clear the cache.
<?php
    $size1
= filesize($filename);
   
unlink($filename);   
   
$size2 = filesize($filename);
   
// $size2 still equals $size1, unless you cleared the stat cache in between.
?>

<?php
    $access
= fileatime($filename);
   
unlink($filename);   
   
$size = filesize($filename);
   
// $size will be the filesize before it was unlinked, because the filesize was cached when fileatime was called, even though the two functions wouldn't appear to have anything to do with either other.
?>

Confirmed on a windows system.

copy> <chown
Last updated: Sat, 24 Mar 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites