opcache_is_script_cached(...) for file cache

From: Date: Thu, 28 Nov 2024 16:58:04 +0000
Subject: opcache_is_script_cached(...) for file cache
Groups: php.internals 
Request: Send a blank email to internals+get-126077@lists.php.net to get a copy of this message
Hello, I'd like to propose a version of opcache_is_script_cached(...) that supports checking the file cache, rather than just SHM. This would be useful when paired with opcache.file_cache_read_only, as it would allow us to more easily check the cache is being used at runtime. It'll also allow us to more easily write automated tests against the file based opcache, which I'd like to do retroactively for my opcache.file_cache_read_only PR. An example PR for this change is here: https://github.com/php/php-src/pull/16979 I'd initially considered changing the function definition to `opcache_is_script_cached(string $filename, bool $file_cache = false), adding a new parameter, bool $file_cache = false`, but defaulting to false so the default / existing behaviour remains the same: when the second parameter is true, it'll check JUST the file cache, not SHM. @Ilija Tovilo has suggested that it might be less confusing to make it its own function, which I'm happy to do. Does anyone want to weigh in on what you think of this functionality, and if/how you'd like to see it implemented? Regards, Samuel Melrose

« previous php.internals (#126077) next »