On 03/19/2015 01:26 PM, Eric Stenson wrote: > PHP Internals folks-- > > We're doing some performance work in WinCache, and we're finding that some > frameworks are...uh...enthusiastically using file_exists(), is_file() and > is_dir() functions on files/directories that don't exist. Every. Single. > Pageload. > > Does the PHP stat cache include negative cache entries? If not, why not? > > Are there any existing extensions that implement a negative cache for > file_exists(), is_file(), et. al.?
We do not do negative caching. This is documented at http://php.net/manual/en/function.clearstatcache.php where it says: 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. But, I think you are also missing the fact that the stat cache is per-request. So your "every single pageload" aspect won't be helped by adding negative caching to the stat cache. It is still going to stat on every single page load. It is only multiple identical stats within the same request that gets caught by the stat cache. -Rasmus
signature.asc
Description: OpenPGP digital signature