Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85257 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98311 invoked from network); 20 Mar 2015 01:13:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2015 01:13:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.52 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.192.52 mail-qg0-f52.google.com Received: from [209.85.192.52] ([209.85.192.52:34609] helo=mail-qg0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7F/34-25408-B247B055 for ; Thu, 19 Mar 2015 20:13:16 -0500 Received: by qgh62 with SMTP id 62so81534002qgh.1 for ; Thu, 19 Mar 2015 18:13:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=SAAqfdS0PIh+RAhZGnZyopoI4hre63dhALX/KmaI0Ak=; b=JN+PbBdyx3Y2ctNXIwDZ3VOTAPjAVxrNZEFF8GOzyfJrNxnAkr5sv0eTR6UAf/epLH +x9H2Qt0hyutw4eoStIB1IVwaSqbBPxRlFn2/MWJ5DHqGJimJjN5kAFEdPChIkwJWG7H wjWNV54hTsSRl8S0NIoWL3rt59WdwWXdk9hWNmTeioKt7wYwO2e/i9kA2yvlr9vUMRch oJeayQzdy2yrDS8+63qDwSoivKcv+LBbjBY/xcJ//vdCKefqiH8TF+4ae/m3QiRnG0f1 vjiqkhrDQgx7/FIn4uxsf1K2N6snjHklYwsocOUyDHhd3GyAl92zHM/yRf9s+jj1D+4+ bjxg== MIME-Version: 1.0 X-Received: by 10.55.22.168 with SMTP id 40mr100333773qkw.101.1426813993500; Thu, 19 Mar 2015 18:13:13 -0700 (PDT) Received: by 10.96.39.195 with HTTP; Thu, 19 Mar 2015 18:13:13 -0700 (PDT) In-Reply-To: <550B733F.8080600@lerdorf.com> References: <550B733F.8080600@lerdorf.com> Date: Fri, 20 Mar 2015 12:13:13 +1100 Message-ID: To: Rasmus Lerdorf Cc: Eric Stenson , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [Q] Does PHP have a negative cache for file stat operations? From: pierre.php@gmail.com (Pierre Joye) On Fri, Mar 20, 2015 at 12:09 PM, Rasmus Lerdorf wrote: > 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. Thanks :) I forgot to mention that here (but in a chat :). Also it would help a little bit as some apps repeatedly check files or paths in the same request. However I am not sure it is worth the addition. Cheers, -- Pierre @pierrejoye | http://www.libgd.org