Define and use the clearstatcache () function to clear the file status cache. The clearstatcache () function caches the returned information of some functions to provide higher performance. However, sometimes, for example, checking the definition and usage of the same file multiple times in a script
The clearstatcache () function clears the file status cache.
The clearstatcache () function caches the returned information of some functions to provide higher performance. But sometimes, for example, if you check the same file multiple times in a script and the file is in danger of being deleted or modified during script execution, you need to clear the file status cache, to get the correct results. To do this, you need to use the clearstatcache () function.
The cached function, that is, the function affected by the clearstatcache () function:
- Stat ()
- Lstat ()
- File_exists ()
- Is_writable ()
- Is_readable ()
- Is_executable ()
- Is_file ()
- Is_dir ()
- Is_link ()
- Filectime ()
- Fileatime ()
- Filemtime ()
- Fileinode ()
- Filegroup ()
- Fileowner ()
- Filesize ()
- Filetype ()
- Fileperms ()
Syntax
Clearstatcache ()
Example
Output:
792100