clearstatcache
CLEARS the file status cache.
When using file_exists, stat, lstat, is_readable, is_writable, is_executable, is_file, is_dir, is_link, fileatime, filectime, filemtime, fileinode, filesize, filetype, fileperms, filegroup or fileowner - PHP caches the information those functions return in order to provide faster performance.
However, in certain cases, you may want to clear the cached information.
For instance, if the same file is being checked multiple times within a single script, and that file is in danger of being removed or changed during that script's operation, you may elect to clear the status cache.
In these cases, you can use the clearstatcache function to clear the information that PHP caches about a file.
You should also note that PHP doesn't cache information about non-existent files.
So, if you call file_exists on a file that doesn't exist, it will return FALSE until you create the file.
If you create the file, it will return TRUE even if you then delete the file.
However unlink clears the cache automatically.
We'll see how to use clearstatcache on the next pages.
<?php
void clearstatcache ( bool $clear_realpath_cache = false ,
str $filename = "" )
where,
$clear_realpath_cache = To control if the realpath cache
will be cleared or not
$filename = The specific filename to be analyzed
?>
$clear_realpath_cache
VALUE |
CONTROL |
FALSE |
The real path will not be cleared |
TRUE |
The real path will be cleared |
ed48 |
$filename
The specific filename to be analyzed.