clearstatcache
Description
The clearstatcache of Filesystem for PHP clears file status cache.
Syntax
clearstatcache(bool $clear_realpath_cache = false, string $filename = ""): void
Parameters
clear_realpath_cache
Whether to clear the realpath cache or not.
filename
Clear the realpath and the stat cache for a specific filename only; only used if clear_realpath_cache is TRUE.
Return
No value is returned.
Examples
1
<? function myfunction($filename) { $stat = stat($filename); $uid = $stat["uid"]; $posix_getpwuid = posix_getpwuid($uid); return $posix_getpwuid["name"]; } $format = "%s: %s\n"; $filename = "clearstatcache.txt"; printf($format, date("r"), myfunction($filename)); chown($filename, "myowner"); printf($format, date("r"), myfunction($filename)); clearstatcache(); printf($format, date("r"), myfunction($filename));
Sat, 07 Dec 2024 16:46:46 +0000: root Sat, 07 Dec 2024 16:46:46 +0000: root Sat, 07 Dec 2024 16:46:46 +0000: myowner
Links
Filesystem
- basename
- chgrp
- chmod
- chown
- copy
- dirname
- disk_free_space
- disk_total_space
- diskfreespace
- fclose
- feof
- fflush
- fgetc
- fgetcsv
- fgets
- file
- file_exists
- file_get_contents
- file_put_contents
- fileatime
- filectime
- filegroup
- fileinode
- filemtime
- fileowner
- fileperms
- filesize
- filetype
- flock
- fnmatch
- fopen
- fpassthru
- fputcsv
- fputs
- fread
- fscanf
- fseek
- fstat
- ftell
- ftruncate
- fwrite
- glob
- is_dir
- is_executable
- is_file
- is_link
- is_readable
- is_uploaded_file
- is_writable
- is_writeable
- lchgrp
- lchown
- link
- linkinfo
- lstat
- mkdir
- move_uploaded_file
- pathinfo
- pclose
- popen
- readfile
- readlink
- realpath
- realpath_cache_get
- realpath_cache_size
- rename
- rewind
- rmdir
- set_file_buffer
- stat
- symlink
- tempnam
- tmpfile
- touch
- umask
- unlink