Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85256 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96587 invoked from network); 20 Mar 2015 01:09:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2015 01:09:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain lerdorf.com designates 209.85.220.44 as permitted sender) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.220.44 mail-pa0-f44.google.com Received: from [209.85.220.44] ([209.85.220.44:35558] helo=mail-pa0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/E3-25408-4437B055 for ; Thu, 19 Mar 2015 20:09:24 -0500 Received: by pagj4 with SMTP id j4so658970pag.2 for ; Thu, 19 Mar 2015 18:09:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type; bh=V4DXypYkKl4uY6tjTBIK3r59yh3JWY+RyCACIJBOK2E=; b=YM1rpY8NboW0m+ZKhmk6lv/aRVHoqYCxDp29Dy95iqzO4OaukjjNDgQDj89cfuMGLz PU+fiM4YtTvNULNn2C5bZEbiul3depUXeMAwzhHQc+0Qw25yDH5lbibMHmja0xkFfANz /lY9ctucepHDFckr2konmEZvfslAjCXXlUSaDCQ84QLnrI6Lx9ym8692gyiceXR8tN1+ 8KsfUCyKYCbdHfyROx9aqVpQr3MRF2ROGj2frJ5T1emiHBCjSgF6QBGy8mWzJj3ISlMJ Qpft26VDUzdFG3mjXS/DWr2B1y0BuZFnNxw9oXoqZf2r3sI/pUTpeT+lAAVhFA5l7h9Y 4n7w== X-Gm-Message-State: ALoCoQmWZqKdcDGPgIkKsg/P80BvV+974wcFDFTxytZ3Ld+N+d1uhHsY18/Ung3/S67ki9HUpCfD X-Received: by 10.66.248.40 with SMTP id yj8mr63269476pac.141.1426813761897; Thu, 19 Mar 2015 18:09:21 -0700 (PDT) Received: from [192.168.200.14] (c-50-131-44-225.hsd1.ca.comcast.net. [50.131.44.225]) by mx.google.com with ESMTPSA id n10sm4986931pdk.68.2015.03.19.18.09.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 18:09:20 -0700 (PDT) Message-ID: <550B733F.8080600@lerdorf.com> Date: Thu, 19 Mar 2015 18:09:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Eric Stenson , "internals@lists.php.net" References: In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JRKOj5rIJsVWxxDa42xLelLwmMr4n83KX" Subject: Re: [PHP-DEV] [Q] Does PHP have a negative cache for file stat operations? From: rasmus@lerdorf.com (Rasmus Lerdorf) --JRKOj5rIJsVWxxDa42xLelLwmMr4n83KX Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 03/19/2015 01:26 PM, Eric Stenson wrote: > PHP Internals folks-- >=20 > We're doing some performance work in WinCache, and we're finding that s= ome frameworks are...uh...enthusiastically using file_exists(), is_file()= and is_dir() functions on files/directories that don't exist. Every. Si= ngle. Pageload. >=20 > Does the PHP stat cache include negative cache entries? If not, why no= t? >=20 > Are there any existing extensions that implement a negative cache for f= ile_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 --JRKOj5rIJsVWxxDa42xLelLwmMr4n83KX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlULcz8ACgkQlxayKTuqOuBajgCeK8F+0Z+dO+7NqEVkFUGLGgYe CnQAnRPbULHRyCTR436BZdZxwmRyg+fm =MtHp -----END PGP SIGNATURE----- --JRKOj5rIJsVWxxDa42xLelLwmMr4n83KX--