Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126170 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id F33411A00BD for ; Sun, 22 Dec 2024 20:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1734899321; bh=CMZb9lFUD8oeqj5YRsvaPxxrgSpoR6RGWgHalYskZjk=; h=Date:Subject:To:References:From:In-Reply-To:From; b=J2s/wJKrHMItmVOxL+iSUt4+944Blvpj/IobqLbyEqFAUBoVMCMolLxz9/dA16f8v 8cTtZivIaYcp+OR8jZEkYsK6aYPN16FihI1X/HBgqLhhKEuhOVRDRDdKzDVxbyW5Rq hg+439h/Kiz1Q6xSQQ6HVkczEi3pTKUIyLnBOP7HJ/ZV39mty9M/ukWd3NVB19zXMH SWkvDOLrbdzNOHunWN8PnN7WEve0IvTD69T/VZ+XtH6U8VmBJXeVjCtl38gk86P2S7 Zaakz1o2v/0MEd5KCzsknoE6wxbqV8vD5F/L5yRWKcDoPz6FrI52+VzL+dJOZd49j+ 3ClSxKpF8dc3w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6B66C18003E for ; Sun, 22 Dec 2024 20:28:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 22 Dec 2024 20:28:39 +0000 (UTC) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-43618283dedso35396265e9.3 for ; Sun, 22 Dec 2024 12:31:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734899500; x=1735504300; darn=lists.php.net; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=BECvS+AkmqfPKyAaTW65BYV4Hkhv9sN5tzKmJP+mSyk=; b=I0ePmG4P12ITy5V4jLo7IMTjl2bvi2Iu4imdNPb6ev6Bi0OPQUkMeloDqcBHHtpbhb Sg14nBF2kbr/vr+CIxDnzZphwFpXMcV4qWoXR5uwVUAnSaO7jtQ0xf5aIf6vYZF6bPDC BdcmnV2dSq2ShwjkH5Ix58aIqWLp85HPKWvveqao98fHiKHeSENz6kGxBTS6Oj+1IaoE lop9dk6yzVEagR4ZOyTOa0bRQ8zHLzd3X/yEtS1IBNT/2bbjWQIRjdm/87jBKbCTA2ye sYf37WvbKZz+y6EMYvmbX8dIHUrp7KP83f6h00NX2m9sFW1OSG/pdSOReUuYl6LD8IvI Z6WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734899500; x=1735504300; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BECvS+AkmqfPKyAaTW65BYV4Hkhv9sN5tzKmJP+mSyk=; b=ooAsix0AavNsB1ueuVUa3Tm3VhGoNpqMCrChPgWvwscNn69l3Guc8KMvLZvgpl/HWZ t1Ra/IlUJH/yN9v9VW4/TzDCGVPQvugmcaHmJk6sxt71hZbhC/DzDUOZRG+5etvi4gyv yzlmEqLKlM1xgoFABTrIcdkT+AQlbeL1XqMZd/XszzrHRJgv3s6dzG0+G96S3nIeMSZM WDZlJnjAQMW6gu0MBGvC8DvGr0/7PV5vIBCVGB1XRRBsxqwP9DoNNXrBE3oed6aHdX18 9puMnU2o4w9u6dc37aK7WwBCo04gOiDHWQISmVsYPxxfojWylWGX9VEgFMuhaASL0i1H effA== X-Gm-Message-State: AOJu0YyAKI62whE0ynY8p60CTqBxlNrPdc4IldgsolJwyIKfcQZMuopJ ly5CeZkCVepmtSC5wn6rN0mZEtjUqV+dyj7U7IXidTTKzO55pZN2kF8Udg== X-Gm-Gg: ASbGncuhTOS6w4KVYGFExpye46A8M0yN3D0gXLcPCaJgFE7w2ldcHCnSLAswtNiLw5X LlrWOYVQbkP/bPh9Yd+6jvRL/4NkTeB1UWlIbj29iiPIBT+3N1hAOoAOuCmY7CBVnFZ7jdJjKAq wIzrlYQLrwaoJD44aaH0qs81QkwmA7/BDW+8U0YNMKLBDspDLH0dvQGsjiChmOPS6ffqNSRK0uS 34+T3YZ4GUT/dx1YbVJy6iJfYtiRNNta7MePXPl0IZFD+Ajt3Y9PgBUn5seo7WaMJhA+SJ1nzSM U/cro8zCvzC0910TZGH8ciAy0VoMB6NCIplQiw3C6FFGasbXsiG/1dPCoZa0RtXOKLSn1pfYCju 8CmIeCDo9oAIcUKF1vW3A X-Google-Smtp-Source: AGHT+IGrFGBA4m5Ztx/JyqFCepPFnKOCVQ+8jL4qrpfAV+6A/IluZv/hSBTgOXLHIrC1nkWPnnKCPg== X-Received: by 2002:a05:600c:4f09:b0:431:12a8:7f1a with SMTP id 5b1f17b1804b1-43668645d57mr93710245e9.16.1734899500174; Sun, 22 Dec 2024 12:31:40 -0800 (PST) Received: from ?IPV6:2a02:1811:cd2f:3500:e093:fcad:4f6:e542? (ptr-du5vm7f5ekzptmf0fgi.18120a2.ip6.access.telenet.be. [2a02:1811:cd2f:3500:e093:fcad:4f6:e542]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8332absm9496216f8f.38.2024.12.22.12.31.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 22 Dec 2024 12:31:39 -0800 (PST) Message-ID: <9169e8f6-a25e-4b69-92fa-a70c0445273f@gmail.com> Date: Sun, 22 Dec 2024 21:32:47 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] Discussion: Remove file statcache? To: internals@lists.php.net References: <27531d9d-9bfe-4acc-b9ab-80b1017e3038@app.fastmail.com> <21dd9ac7-e81b-4509-bfa4-a36d05237270@gmail.com> <614d3f45-0f54-4a2e-a21e-2eec5f496fa0@gmail.com> <22132ea8-9e5b-4688-9bf4-4a1972e347b1@rwec.co.uk> Content-Language: en-US In-Reply-To: <22132ea8-9e5b-4688-9bf4-4a1972e347b1@rwec.co.uk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit From: dossche.niels@gmail.com (Niels Dossche) On 22/12/2024 13:16, Rowan Tommins [IMSoP] wrote: > On 21/12/2024 20:50, Niels Dossche wrote: >> Adding a parameter for a cache, which should've been transparent in the first place, to every file operation is messy. > > > I would say it's less messy than having to work out when to turn a global setting on or off. In particular, it would be horrible for shared libraries, the equivalent of the above would be something like this: > > $old_cache_setting = ini_set('enable_stat_cache', 1); > $perms = fileperms($name); $size = filesize($name); ini_set('enable_stat_cache', $old_cache_setting); > > Similarly, for the false case, library code would either have to assume the cache might be enabled, and call clearstatcache() just in case; or it would have to carefully wrap code in similar ini_set blocks. > > As far as I can see, both code that benefits from the cache, and code that suffers from it, is very rare; but if you know you're writing one or the other, having an explicit way to mark *that code* seems more appropriate than toggling a global setting. I see your argument (hah!) for shared libraries. But the programmer effort of adding the extra argument to calls starts to outweigh the global ini setting approach quickly, as the global ini setting has a "fixed cost" of two lines of code while adding a parameter scales in the number of calls the programmer has to change. > >> But if you want to add extra parameters to functions that can potentially touch the stat cache, then you need to take into account spl as well. Adding extra parameters to the functions in those classes are a BC break because the signature of potential userland function overrides would no longer be compatible at compile time. > > > Ah yes, I hadn't thought of objects being affected. On the other hand, objects have an obvious place to store both the state of the setting and the cache itself: on the instance. I do agree with this yes. All in all though, I'm not convinced by the parameter approach. I'd like a proper solution rather than some plaster. There are some options: 1) Try to fix the stat cache. 2) Put stat cache behind an ini knob. 3) Get rid of the stat cache. All of these simplify the developer experience. Adding more configuration knobs or extra parameters add complexity. I'd like to see more simplification. Kind regards Niels