Skip to content

Commit 5b2625d

Browse files
committed
add OPCache file cache and JIT blacklist functions
1 parent a148eb0 commit 5b2625d

File tree

4 files changed

+185
-2
lines changed

4 files changed

+185
-2
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<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">
4+
<refnamediv>
5+
<refname>opcache_is_script_cached_in_file_cache</refname>
6+
<refpurpose>Tells whether a script is cached in OPCache file cache</refpurpose>
7+
</refnamediv>
8+
9+
<refsect1 role="description">
10+
&reftitle.description;
11+
<methodsynopsis>
12+
<type>bool</type><methodname>opcache_is_script_cached_in_file_cache</methodname>
13+
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
14+
</methodsynopsis>
15+
<simpara>
16+
This function checks if a PHP script has been cached in OPCache. This can be
17+
used to more easily detect the "warming" of the cache for a particular script.
18+
This function only checks file cache cache, not in-memory cache. In order to
19+
check in-memory cache, use <function>opcache_is_script_cached</function>.
20+
</simpara>
21+
</refsect1>
22+
23+
<refsect1 role="parameters">
24+
&reftitle.parameters;
25+
<variablelist>
26+
<varlistentry>
27+
<term><parameter>filename</parameter></term>
28+
<listitem>
29+
<simpara>
30+
The path to the PHP script to be checked.
31+
</simpara>
32+
</listitem>
33+
</varlistentry>
34+
</variablelist>
35+
</refsect1>
36+
37+
<refsect1 role="returnvalues">
38+
&reftitle.returnvalues;
39+
<simpara>
40+
Returns &true; if <parameter>filename</parameter> is cached in OPCache,
41+
&false; otherwise.
42+
</simpara>
43+
</refsect1>
44+
45+
<refsect1 role="seealso">
46+
&reftitle.seealso;
47+
<simplelist>
48+
<member><function>opcache_compile_file</function></member>
49+
<member><function>opcache_is_script_cached</function></member>
50+
</simplelist>
51+
</refsect1>
52+
</refentry>
53+
<!-- Keep this comment at the end of the file
54+
Local variables:
55+
mode: sgml
56+
sgml-omittag:t
57+
sgml-shorttag:t
58+
sgml-minimize-attributes:nil
59+
sgml-always-quote-attributes:t
60+
sgml-indent-step:1
61+
sgml-indent-data:t
62+
indent-tabs-mode:nil
63+
sgml-parent-document:nil
64+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
65+
sgml-exposed-tags:nil
66+
sgml-local-catalogs:nil
67+
sgml-local-ecat-files:nil
68+
End:
69+
vim600: syn=xml fen fdm=syntax fdl=2 si
70+
vim: et tw=78 syn=sgml
71+
vi: ts=1 sw=1
72+
-->

reference/opcache/functions/opcache-is-script-cached.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
<simpara>
1616
This function checks if a PHP script has been cached in OPCache. This can be
1717
used to more easily detect the "warming" of the cache for a particular script.
18-
This function only checks in-memory cache, not file cache.
18+
This function only checks in-memory cache, not file cache. In order to
19+
check file cache, use <function>opcache_is_script_cached_in_file_cache</function>.
1920
</simpara>
2021
</refsect1>
2122

@@ -36,7 +37,7 @@
3637
<refsect1 role="returnvalues">
3738
&reftitle.returnvalues;
3839
<simpara>
39-
Returns &true; if <parameter>filename</parameter> is cached in OPCache,
40+
Returns &true; if <parameter>filename</parameter> is cached in OPCache in-memory cache,
4041
&false; otherwise.
4142
</simpara>
4243
</refsect1>
@@ -45,6 +46,7 @@
4546
&reftitle.seealso;
4647
<simplelist>
4748
<member><function>opcache_compile_file</function></member>
49+
<member><function>opcache_is_script_cached_in_file_cache</function></member>
4850
</simplelist>
4951
</refsect1>
5052
</refentry>
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<refentry xml:id="function.opcache-jit-blacklist" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4+
<refnamediv>
5+
<refname>opcache_jit_blacklist</refname>
6+
<refpurpose>Blacklists a function from being JIT compiled</refpurpose>
7+
</refnamediv>
8+
9+
<refsect1 role="description">
10+
&reftitle.description;
11+
<methodsynopsis>
12+
<type>void</type>
13+
<methodname>opcache_jit_blacklist</methodname>
14+
<methodparam>
15+
<type>Closure</type>
16+
<parameter>closure</parameter>
17+
</methodparam>
18+
</methodsynopsis>
19+
<simpara>
20+
This function blacklists a particular function from being JIT compiled when Tracing JIT is in use.
21+
The function is specified using a <classname>Closure</classname>.
22+
</simpara>
23+
<warning>
24+
<simpara>
25+
Any parts of the function that were already JIT compiled remain unaffected
26+
and will still be JIT compiled.
27+
</simpara>
28+
</warning>
29+
</refsect1>
30+
31+
<refsect1 role="parameters">
32+
&reftitle.parameters;
33+
<variablelist>
34+
<varlistentry>
35+
<term>
36+
<parameter>closure</parameter>
37+
</term>
38+
<listitem>
39+
<simpara>
40+
The function to blacklist, represented as a first class callable.
41+
It is also possible to pass an anonymous function,
42+
in which case the anonymous function itself is blacklisted.
43+
</simpara>
44+
</listitem>
45+
</varlistentry>
46+
</variablelist>
47+
</refsect1>
48+
49+
<refsect1 role="returnvalues">
50+
&reftitle.returnvalues;
51+
<simpara>
52+
&return.void;
53+
</simpara>
54+
</refsect1>
55+
56+
<refsect1 role="examples">
57+
&reftitle.examples;
58+
<example>
59+
<title>
60+
<function>opcache_jit_blacklist</function>
61+
basic example
62+
</title>
63+
<programlisting role="php">
64+
<![CDATA[
65+
<?php
66+
function foo() {
67+
$x = 1;
68+
$x += 0;
69+
++$x;
70+
var_dump($x);
71+
}
72+
opcache_jit_blacklist(foo(...));
73+
foo();
74+
?>
75+
]]>
76+
</programlisting>
77+
</example>
78+
</refsect1>
79+
80+
<refsect1 role="seealso">
81+
&reftitle.seealso;
82+
<simplelist>
83+
<member><function>opcache_invalidate</function></member>
84+
<member><function>opcache_reset</function></member>
85+
</simplelist>
86+
</refsect1>
87+
</refentry>
88+
<!-- Keep this comment at the end of the file
89+
Local variables:
90+
mode: sgml
91+
sgml-omittag:t
92+
sgml-shorttag:t
93+
sgml-minimize-attributes:nil
94+
sgml-always-quote-attributes:t
95+
sgml-indent-step:1
96+
sgml-indent-data:t
97+
indent-tabs-mode:nil
98+
sgml-parent-document:nil
99+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
100+
sgml-exposed-tags:nil
101+
sgml-local-catalogs:nil
102+
sgml-local-ecat-files:nil
103+
End:
104+
vim600: syn=xml fen fdm=syntax fdl=2 si
105+
vim: et tw=78 syn=sgml
106+
vi: ts=1 sw=1
107+
-->

reference/opcache/versions.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<function name="opcache_get_status" from="PHP 5 &gt;= 5.5.0, PHP 7, PHP 8, PECL ZendOpcache &gt; 7.0.2"/>
1010
<function name="opcache_invalidate" from="PHP 5 &gt;= 5.5.0, PHP 7, PHP 8, PECL ZendOpcache &gt;= 7.0.0"/>
1111
<function name="opcache_is_script_cached" from="PHP 5 &gt;= 5.5.11, PHP 7, PHP 8, PECL ZendOpcache &gt;= 7.0.4"/>
12+
<function name="opcache_is_script_cached_in_file_cache" from="PHP 8 &gt;= 8.5.0"/>
13+
<function name="opcache_jit_blacklist" from="PHP 8 &gt;= 8.4.0"/>
1214
<function name="opcache_reset" from="PHP 5 &gt;= 5.5.0, PHP 7, PHP 8, PECL ZendOpcache &gt;= 7.0.0"/>
1315
</versions>
1416
<!-- Keep this comment at the end of the file

0 commit comments

Comments
 (0)