[doc-en] master: Add OPCache file cache and JIT blacklist functions (#5050)

From: Date: Mon, 19 Jan 2026 00:34:12 +0000
Subject: [doc-en] master: Add OPCache file cache and JIT blacklist functions (#5050)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23009@lists.php.net to get a copy of this message
Author: Jordi Kroon (jordikroon) Committer: GitHub (web-flow) Pusher: Girgias Date: 2026-01-19T00:34:10Z Commit: https://github.com/php/doc-en/commit/3c36a56c9e6875fbe3295827a15747d6eae9572e Raw diff: https://github.com/php/doc-en/commit/3c36a56c9e6875fbe3295827a15747d6eae9572e.diff Add OPCache file cache and JIT blacklist functions (#5050) Changed paths: A reference/opcache/functions/opcache-is-script-cached-in-file-cache.xml A reference/opcache/functions/opcache-jit-blacklist.xml M reference/opcache/functions/opcache-is-script-cached.xml M reference/opcache/versions.xml Diff: diff --git a/reference/opcache/functions/opcache-is-script-cached-in-file-cache.xml b/reference/opcache/functions/opcache-is-script-cached-in-file-cache.xml new file mode 100644 index 000000000000..21486d4841b7 --- /dev/null +++ b/reference/opcache/functions/opcache-is-script-cached-in-file-cache.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision$ --> +<refentry xml:id="function.opcache-is-script-cached-in-file-cache" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>opcache_is_script_cached_in_file_cache</refname> + <refpurpose>Tells whether a script is cached in OPCache file cache</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>bool</type><methodname>opcache_is_script_cached_in_file_cache</methodname> + <methodparam><type>string</type><parameter>filename</parameter></methodparam> + </methodsynopsis> + <simpara> + This function checks if a PHP script has been cached in OPCache. This can be + used to more easily detect the "warming" of the cache for a particular script. + This function only checks file cache cache, not in-memory cache. In order to + check in-memory cache, use <function>opcache_is_script_cached</function>. + </simpara> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <variablelist> + <varlistentry> + <term><parameter>filename</parameter></term> + <listitem> + <simpara> + The path to the PHP script to be checked. + </simpara> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <simpara> + Returns &true; if <parameter>filename</parameter> is cached in OPCache, + &false; otherwise. + </simpara> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><function>opcache_compile_file</function></member> + <member><function>opcache_is_script_cached</function></member> + </simplelist> + </refsect1> +</refentry> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> diff --git a/reference/opcache/functions/opcache-is-script-cached.xml b/reference/opcache/functions/opcache-is-script-cached.xml index a850f1634ed9..24b1e935d00a 100644 --- a/reference/opcache/functions/opcache-is-script-cached.xml +++ b/reference/opcache/functions/opcache-is-script-cached.xml @@ -16,6 +16,8 @@ This function checks if a PHP script has been cached in OPCache. This can be used to more easily detect the "warming" of the cache for a particular script. This function only checks in-memory cache, not file cache. + In order to check file cache, use + <function>opcache_is_script_cached_in_file_cache</function>. </simpara> </refsect1> @@ -36,7 +38,7 @@ <refsect1 role="returnvalues"> &reftitle.returnvalues; <simpara> - Returns &true; if <parameter>filename</parameter> is cached in OPCache, + Returns &true; if <parameter>filename</parameter> is cached in OPCache in-memory cache, &false; otherwise. </simpara> </refsect1> @@ -45,6 +47,7 @@ &reftitle.seealso; <simplelist> <member><function>opcache_compile_file</function></member> + <member><function>opcache_is_script_cached_in_file_cache</function></member> </simplelist> </refsect1> </refentry> diff --git a/reference/opcache/functions/opcache-jit-blacklist.xml b/reference/opcache/functions/opcache-jit-blacklist.xml new file mode 100644 index 000000000000..8cf6b3789bab --- /dev/null +++ b/reference/opcache/functions/opcache-jit-blacklist.xml @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision$ --> +<refentry xml:id="function.opcache-jit-blacklist" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>opcache_jit_blacklist</refname> + <refpurpose>Blacklists a function from being JIT compiled</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>void</type> + <methodname>opcache_jit_blacklist</methodname> + <methodparam> + <type>Closure</type> + <parameter>closure</parameter> + </methodparam> + </methodsynopsis> + <simpara> + This function blacklists a particular function from being JIT compiled when Tracing JIT is in use. + The function is specified using a <classname>Closure</classname>. + </simpara> + <warning> + <simpara> + Any parts of the function that were already JIT compiled remain unaffected + and will still be JIT compiled. + </simpara> + </warning> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <variablelist> + <varlistentry> + <term> + <parameter>closure</parameter> + </term> + <listitem> + <simpara> + The function to blacklist, represented as a first class callable. + It is also possible to pass an anonymous function, + in which case the anonymous function itself is blacklisted. + </simpara> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <simpara> + &return.void; + </simpara> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <example> + <title> + <function>opcache_jit_blacklist</function> + basic example + </title> + <programlisting role="php"> +<![CDATA[ +<?php +function foo() { + $x = 1; + $x += 0; + ++$x; + var_dump($x); +} +opcache_jit_blacklist(foo(...)); +foo(); +?> +]]> + </programlisting> + </example> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><function>opcache_invalidate</function></member> + <member><function>opcache_reset</function></member> + </simplelist> + </refsect1> +</refentry> + <!-- Keep this comment at the end of the file + Local variables: + mode: sgml + sgml-omittag:t + sgml-shorttag:t + sgml-minimize-attributes:nil + sgml-always-quote-attributes:t + sgml-indent-step:1 + sgml-indent-data:t + indent-tabs-mode:nil + sgml-parent-document:nil + sgml-default-dtd-file:"~/.phpdoc/manual.ced" + sgml-exposed-tags:nil + sgml-local-catalogs:nil + sgml-local-ecat-files:nil + End: + vim600: syn=xml fen fdm=syntax fdl=2 si + vim: et tw=78 syn=sgml + vi: ts=1 sw=1 + --> diff --git a/reference/opcache/versions.xml b/reference/opcache/versions.xml index 9a5363ab1342..36aa3ea44739 100644 --- a/reference/opcache/versions.xml +++ b/reference/opcache/versions.xml @@ -9,6 +9,8 @@ <function name="opcache_get_status" from="PHP 5 &gt;= 5.5.0, PHP 7, PHP 8, PECL ZendOpcache &gt; 7.0.2"/> <function name="opcache_invalidate" from="PHP 5 &gt;= 5.5.0, PHP 7, PHP 8, PECL ZendOpcache &gt;= 7.0.0"/> <function name="opcache_is_script_cached" from="PHP 5 &gt;= 5.5.11, PHP 7, PHP 8, PECL ZendOpcache &gt;= 7.0.4"/> + <function name="opcache_is_script_cached_in_file_cache" from="PHP 8 &gt;= 8.5.0"/> + <function name="opcache_jit_blacklist" from="PHP 8 &gt;= 8.4.0"/> <function name="opcache_reset" from="PHP 5 &gt;= 5.5.0, PHP 7, PHP 8, PECL ZendOpcache &gt;= 7.0.0"/> </versions> <!-- Keep this comment at the end of the file

« previous php.doc.cvs (#23009) next »