On Sat, Nov 24, 2018 at 1:18 AM Rowan Collins <rowan.coll...@gmail.com> wrote:
> On 23 November 2018 12:48:40 GMT+00:00, Dmitry Stogov <dmi...@zend.com> > wrote: > >Especially, the main preload.php, usually should be marked, to disable > >its caching. > > Sorry, could you explain for those of us in the peanut gallery why this is > the case? I'm struggling to understand what it means to preload something > but not cache it, and suspect I'm missing something fundamental. > > I'm not sure if you're missing anything fundamental - it's just that the preload.php file Dmitry's referring to (the one that's responsible to loading all the other files) - is one file that's pretty much by definition, will be of no use at any later point in the lifetime of the server. It preloads other files (which of course, should very much persist in the opcache memory) - but once it's done, it's done. That's why it kind of makes sense not to cache it. That said, I'm not sure whether having this feature as a declare() makes sense - at least in the context of the new preload feature. The preload file is likely to be fairly small, wouldn't it consume negligible amounts of shared memory and just one slot in the files table? And like Pierre suggested, perhaps we can simply default to not caching the main preload file (i.e. the one referenced by php.ini). Outside the context of preloading, there's probably some value in having this new declare() option. There are situations where you simply don't want to cache certain files (what I usually bumped into was in case of auto-generated, short-TTL files). That's why a lifetime or two ago we added the blacklist feature - the declare() syntax would offer a new way to do that that is configurationless and built into the code. In that sense, it's not a bad thing. I'm just seeing it as not so much related to preloading, and more of a general-purpose feature. Unless of course I'm missing something..? Zeev