Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85267 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41451 invoked from network); 20 Mar 2015 09:00:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2015 09:00:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=lisachenko.it@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=lisachenko.it@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.46 as permitted sender) X-PHP-List-Original-Sender: lisachenko.it@gmail.com X-Host-Fingerprint: 74.125.82.46 mail-wg0-f46.google.com Received: from [74.125.82.46] ([74.125.82.46:33027] helo=mail-wg0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BC/1A-25408-4B1EB055 for ; Fri, 20 Mar 2015 04:00:36 -0500 Received: by wgbcc7 with SMTP id cc7so83613353wgb.0 for ; Fri, 20 Mar 2015 02:00:33 -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=f8Aq2uBOF/FLD/iOPFoRRir5waRcWVb/MQsR5lDmVeo=; b=S7kKNNDIJHBv5reBVEWjwh3Vx46/Z57vbmRbNeIs3ubGTwdGa59CLy7qnrOUAz7Pm7 TL6cZNKeOTycYRUdZqsVUYRGOLbMI4QuvXVo+tPKxCzXWhKosioM6PfKONJ27kFZrxdW +lDfT5qpbcQFO142hZyzMbuow1G73T7HBGmbg3fYur8TxkJzX8Ioz9rWqt2+nRzyaYPh oXSgNICwFxtvlNNuyqS7mFVmwLI6hTyQZuDuoFrSzPOc7C6Vy1xpkgO7juEhW2GyeHHZ +p51T6E6HHSZ/7oPW+t7TOaT0PrxUb1PQC1tekvxCW+3Pk9FaVecaMwy5nrh4tzIsM5A 6ldQ== MIME-Version: 1.0 X-Received: by 10.194.200.68 with SMTP id jq4mr160655134wjc.58.1426842033696; Fri, 20 Mar 2015 02:00:33 -0700 (PDT) Received: by 10.194.154.229 with HTTP; Fri, 20 Mar 2015 02:00:33 -0700 (PDT) In-Reply-To: <550BBA87.6070307@gmail.com> References: <550BBA87.6070307@gmail.com> Date: Fri, 20 Mar 2015 12:00:33 +0300 Message-ID: To: Stanislav Malyshev Cc: Eric Stenson , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7b86ea9691b6d60511b48c4a Subject: Re: [PHP-DEV] [Q] Does PHP have a negative cache for file stat operations? From: lisachenko.it@gmail.com (Alexander Lisachenko) --047d7b86ea9691b6d60511b48c4a Content-Type: text/plain; charset=UTF-8 I want to mention http://php.net/manual/en/opcache.configuration.php#ini.opcache.enable-file-override option, that can cache positive checks information between subsequent requests. Thanks! 2015-03-20 9:13 GMT+03:00 Stanislav Malyshev : > Hi! > > > 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? > > Negative cache is tricky. Most frequent patterns look like this: > > 1. if(file_exists("blah")) { do stuff } > > 2. if(!file_exists("blah")) { throw new Exception("no blah!"); } > do stuff > > 3. if(!file_exists("blah")) { create("blah"); } > do stuff > > Caching negative even short term would subtly break case 3, in that it > would force creation of the file every time, thus killing any benefit > from any caching (usually file creation is much more expensive process). > Long term caching would also be big trouble with case 2. Unless there's > a way to reset the cache and the app is very careful to do it - but file > can be created by external means and also case 2 would be harder to fix > without losing the benefits of caching. > > So one may ask, why case 1 is not a problem? Usually it's because if the > file is there, apps rarely delete them by themselves, or at least adding > new files is much more frequent operation than deleting existing ones > that are used by the app. > -- > Stas Malyshev > smalyshev@gmail.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --047d7b86ea9691b6d60511b48c4a--