mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
initial apc docs -- feel free to tweak
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@193356 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
513b02edae
commit
41f441d8fb
10 changed files with 1226 additions and 0 deletions
107
reference/apc/functions/apc-cache-info.xml
Normal file
107
reference/apc/functions/apc-cache-info.xml
Normal file
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.apc-cache-info">
|
||||
<refnamediv>
|
||||
<refname>apc_cache_info</refname>
|
||||
<refpurpose>
|
||||
Retrieves cached information (and meta-data) from APC's data store
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>apc_cache_info</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Array of cached data (and meta-data), or &false; on failure
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
<function>apc_cache_info</function> will raise a warning if it is unable to
|
||||
retrieve APC cache data. This typically occurs when APC is not enabled.
|
||||
</simpara>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>apc_cache_info</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
print_r(apc_cache_info());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
[num_slots] => 2000
|
||||
[ttl] => 0
|
||||
[num_hits] => 9
|
||||
[num_misses] => 3
|
||||
[start_time] => 1123958803
|
||||
[cache_list] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[filename] => /path/to/apc_test.php
|
||||
[device] => 29954
|
||||
[inode] => 1130511
|
||||
[type] => file
|
||||
[num_hits] => 1
|
||||
[mtime] => 1123960686
|
||||
[creation_time] => 1123960696
|
||||
[deletion_time] => 0
|
||||
[access_time] => 1123962864
|
||||
[ref_count] => 1
|
||||
[mem_size] => 677
|
||||
)
|
||||
[1] => Array (...iterates for each cached file)
|
||||
)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="apc.configuration">APC configuration directives</link></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</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:"../../../../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
|
||||
-->
|
38
reference/apc/functions/apc-clear-cache.xml
Normal file
38
reference/apc/functions/apc-clear-cache.xml
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.apc-clear-cache">
|
||||
<refnamediv>
|
||||
<refname>apc_clear_cache</refname>
|
||||
<refpurpose>
|
||||
Clears the APC cache
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>apc_clear_cache</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</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:"../../../../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
|
||||
-->
|
146
reference/apc/functions/apc-define-constants.xml
Normal file
146
reference/apc/functions/apc-define-constants.xml
Normal file
|
@ -0,0 +1,146 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.apc-define-constants">
|
||||
<refnamediv>
|
||||
<refname>apc_define_constants</refname>
|
||||
<refpurpose>
|
||||
Defines a set of constants for later retrieval and mass-definition
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>apc_define_constants</methodname>
|
||||
<methodparam><type>string</type><parameter>key</parameter></methodparam>
|
||||
<methodparam><type>array</type><parameter>constants</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>case_sensitive</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
<function>define</function> is notoriously slow. Since the main benefit of
|
||||
APC is to increase the performance of scripts/applications, this mechanism
|
||||
is provided to streamline the process of mass constant definition.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<simpara>
|
||||
To remove a set of stored constants (without clearing the entire cache), an
|
||||
empty array may be passed as the <parameter>constants</parameter>
|
||||
parameter, effectively clearing the stored value(s).
|
||||
</simpara>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>key</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <parameter>key</parameter> serves as the name of the constant set
|
||||
being stored. This <parameter>key</parameter> is used to retrieve the
|
||||
stored constants in <function>apc_load_constants</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>constants</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
An associative array of <literal>constant_name => value</literal>
|
||||
pairs. The <literal>constant_name</literal> must follow the normal
|
||||
<link linkend="language.constants">constant</link> naming rules.
|
||||
<literal>value</literal> must evaluate to a scalar value.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>case_sensitive</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The default behaviour for constants is to be declared case-sensitive;
|
||||
i.e. <literal>CONSTANT</literal> and <literal>Constant</literal>
|
||||
represent different values. If this parameter evaluates to &false; the
|
||||
constants will be declared as case-insensitive symbols.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>apc_define_constants</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$constants = array(
|
||||
'ONE' => 1,
|
||||
'TWO' => 2,
|
||||
'THREE' => 3,
|
||||
);
|
||||
apc_define_constants('numbers', $constants);
|
||||
apc_load_constants('numbers');
|
||||
echo ONE, TWO, THREE;
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
123
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>apc_load_constants</function></member>
|
||||
<member><function>define</function></member>
|
||||
<member><function>constant</function></member>
|
||||
<member>
|
||||
Or <link linkend="language.constants">the PHP constants reference</link>
|
||||
</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</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:"../../../../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
|
||||
-->
|
90
reference/apc/functions/apc-delete.xml
Normal file
90
reference/apc/functions/apc-delete.xml
Normal file
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.apc-delete">
|
||||
<refnamediv>
|
||||
<refname>apc_delete</refname>
|
||||
<refpurpose>
|
||||
Removes a stored variable from the cache
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>apc_delete</methodname>
|
||||
<methodparam><type>string</type><parameter>key</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>key</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <parameter>key</parameter> used to store the value (with
|
||||
<function>apc_store</function>).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>apc_delete</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$bar = 'BAR';
|
||||
apc_store('foo', $bar);
|
||||
apc_delete('foo'));
|
||||
// this is obviously useless in this form
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>apc_store</function></member>
|
||||
<member><function>apc_fetch</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</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:"../../../../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
|
||||
-->
|
95
reference/apc/functions/apc-fetch.xml
Normal file
95
reference/apc/functions/apc-fetch.xml
Normal file
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.apc-fetch">
|
||||
<refnamediv>
|
||||
<refname>apc_fetch</refname>
|
||||
<refpurpose>
|
||||
Fetch a stored variable from the cache
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>apc_fetch</methodname>
|
||||
<methodparam><type>string</type><parameter>key</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>key</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <parameter>key</parameter> used to store the value (with
|
||||
<function>apc_store</function>).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
The stored variable on success; &false; on failure
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>apc_fetch</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$bar = 'BAR';
|
||||
apc_store('foo', $bar);
|
||||
var_dump(apc_fetch('foo'));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
string(3) "BAR"
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>apc_store</function></member>
|
||||
<member><function>apc_delete</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</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:"../../../../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
|
||||
-->
|
116
reference/apc/functions/apc-load-constants.xml
Normal file
116
reference/apc/functions/apc-load-constants.xml
Normal file
|
@ -0,0 +1,116 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.apc-load-constants">
|
||||
<refnamediv>
|
||||
<refname>apc_load_constants</refname>
|
||||
<refpurpose>
|
||||
Loads a set of constants from the cache
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>apc_load_constants</methodname>
|
||||
<methodparam><type>string</type><parameter>key</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>case_sensitive</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>key</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of the constant set (that was stored with
|
||||
<function>apc_define_constants</function>) to be retrieved.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>case_sensitive</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The default behaviour for constants is to be declared case-sensitive;
|
||||
i.e. <literal>CONSTANT</literal> and <literal>Constant</literal>
|
||||
represent different values. If this parameter evaluates to &false; the
|
||||
constants will be declared as case-insensitive symbols.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>apc_load_constants</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$constants = array(
|
||||
'ONE' => 1,
|
||||
'TWO' => 2,
|
||||
'THREE' => 3,
|
||||
);
|
||||
apc_define_constants('numbers', $constants);
|
||||
apc_load_constants('numbers');
|
||||
echo ONE, TWO, THREE;
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
123
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>apc_define_constants</function></member>
|
||||
<member><function>define</function></member>
|
||||
<member><function>constant</function></member>
|
||||
<member>
|
||||
Or <link linkend="language.constants">the PHP constants reference</link>
|
||||
</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</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:"../../../../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
|
||||
-->
|
97
reference/apc/functions/apc-sma-info.xml
Normal file
97
reference/apc/functions/apc-sma-info.xml
Normal file
|
@ -0,0 +1,97 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.apc-sma-info">
|
||||
<refnamediv>
|
||||
<refname>apc_sma_info</refname>
|
||||
<refpurpose>
|
||||
Retrieves APC's Shared Memory Allocation information
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>apc_sma_info</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Array of Shared Memory Allocation data; &false; on failure.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>apc_sma_info</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
print_r(apc_sma_info());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
[num_seg] => 1
|
||||
[seg_size] => 31457280
|
||||
[avail_mem] => 31448408
|
||||
[block_lists] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[size] => 31448408
|
||||
[offset] => 8864
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member>
|
||||
<link linkend="apc.configuration">APC configuration directives</link>
|
||||
</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</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:"../../../../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
|
||||
-->
|
129
reference/apc/functions/apc-store.xml
Normal file
129
reference/apc/functions/apc-store.xml
Normal file
|
@ -0,0 +1,129 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.apc-store">
|
||||
<refnamediv>
|
||||
<refname>apc_store</refname>
|
||||
<refpurpose>
|
||||
Cache a variable in the data store
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>apc_store</methodname>
|
||||
<methodparam><type>string</type><parameter>key</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>ttl</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<note>
|
||||
<simpara>
|
||||
Unlike many other mechanisms in PHP, variables stored using
|
||||
<function>apc_store</function> will persist between requests (until the
|
||||
value is removed from the cache).
|
||||
</simpara>
|
||||
</note>
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>key</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Store the variable using this name. <parameter>key</parameter>s are
|
||||
cache-unique, so storing a second value with the same
|
||||
<parameter>key</parameter> will overwrite the original value.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>var</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The variable to store
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>ttl</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Time To Live; store <parameter>var</parameter> in the cache for
|
||||
<parameter>ttl</parameter> seconds. After the
|
||||
<parameter>ttl</parameter> has passed, the stored variable will be
|
||||
automatically expunged from the cache. If no <parameter>ttl</parameter>
|
||||
is supplied (or if the <parameter>ttl</parameter> is
|
||||
<literal>0</literal>), the value will persist until it is removed from
|
||||
the cache manually, or otherwise fails to exist in the cache (clear,
|
||||
restart, etc.).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>apc_store</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$bar = 'BAR';
|
||||
apc_store('foo', $bar);
|
||||
var_dump(apc_fetch('foo'));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
string(3) "BAR"
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>apc_fetch</function></member>
|
||||
<member><function>apc_delete</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</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:"../../../../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
|
||||
-->
|
342
reference/apc/ini.xml
Normal file
342
reference/apc/ini.xml
Normal file
|
@ -0,0 +1,342 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<section id="apc.configuration">
|
||||
&reftitle.runtime;
|
||||
&extension.runtime;
|
||||
<para>
|
||||
Although the default APC settings are fine for many installations, serious
|
||||
users should consider tuning the following parameters.
|
||||
</para>
|
||||
<para>
|
||||
<table>
|
||||
<title>APC configuration options</title>
|
||||
<tgroup cols="4">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Name</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Changeable</entry>
|
||||
<entry>Changelog</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>apc.enabled</entry>
|
||||
<entry>1</entry>
|
||||
<entry>PHP_INI_ALL</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>apc.shm_segments</entry>
|
||||
<entry>1</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>apc.shm_size</entry>
|
||||
<entry>30</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>apc.optimization</entry>
|
||||
<entry>0</entry>
|
||||
<entry>PHP_INI_ALL</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>apc.num_files_hint</entry>
|
||||
<entry>1000</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>apc.ttl</entry>
|
||||
<entry>0</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>apc.gc_ttl</entry>
|
||||
<entry>3600</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>apc.cache_by_default</entry>
|
||||
<entry>On</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>apc.filters</entry>
|
||||
<entry>""</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>apc.mmap_file_mask</entry>
|
||||
<entry>""</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>apc.slam_defense</entry>
|
||||
<entry>0</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>apc.file_update_protection</entry>
|
||||
<entry>2</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
&ini.php.constants;
|
||||
</para>
|
||||
|
||||
&ini.descriptions.title;
|
||||
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry id="ini.apc.enabled">
|
||||
<term>
|
||||
<parameter>apc.enabled</parameter>
|
||||
<type>boolean</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>apc.enabled</literal> can be set to 0 to disable APC. This is
|
||||
primarily useful when APC is statically compiled
|
||||
into PHP, since there is no other way to disable
|
||||
it (when compiled as a DSO, the <literal>zend_extension</literal>
|
||||
line can just be commented-out).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry id="ini.apc.shm-segments">
|
||||
<term>
|
||||
<parameter>apc.shm_segments</parameter>
|
||||
<type>integer</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The number of shared memory segments to allocate
|
||||
for the compiler cache. If APC is running out of
|
||||
shared memory but you have already set
|
||||
<literal>apc.shm_size</literal> as high as your system allows, you
|
||||
can try raising this value.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry id="ini.apc.shm-size">
|
||||
<term>
|
||||
<parameter>apc.shm_size</parameter>
|
||||
<type>integer</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The size of each shared memory segment in MB.
|
||||
By default, some systems (including most BSD
|
||||
variants) have very low limits on the size of a
|
||||
shared memory segment.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry id="ini.apc.optimization">
|
||||
<term>
|
||||
<parameter>apc.optimization</parameter>
|
||||
<type>integer</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The optimization level. Zero disables the
|
||||
optimizer, and higher values use more aggressive
|
||||
optimizations. Expect very modest speed
|
||||
improvements. This is experimental.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry id="ini.apc.num-files-hint">
|
||||
<term>
|
||||
<parameter>apc.num_files_hint</parameter>
|
||||
<type>integer</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A "hint" about the number of distinct source files
|
||||
that will be included or requested on your web
|
||||
server. Set to zero or omit if you're not sure;
|
||||
this setting is mainly useful for sites that have
|
||||
many thousands of source files.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry id="ini.apc.ttl">
|
||||
<term>
|
||||
<parameter>apc.ttl</parameter>
|
||||
<type>integer</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The number of seconds a cache entry is allowed to
|
||||
idle in a slot in case this cache entry slot is
|
||||
needed by another entry. Leaving this at zero
|
||||
means that your cache could potentially fill up
|
||||
with stale entries while newer entries won't be
|
||||
cached.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry id="ini.apc.gc-ttl">
|
||||
<term>
|
||||
<parameter>apc.gc_ttl</parameter>
|
||||
<type>integer</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The number of seconds that a cache entry may
|
||||
remain on the garbage-collection list. This value
|
||||
provides a failsafe in the event that a server
|
||||
process dies while executing a cached source file;
|
||||
if that source file is modified, the memory
|
||||
allocated for the old version will not be
|
||||
reclaimed until this TTL reached. Set to zero to
|
||||
disable this feature.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry id="ini.apc.cache-by-default">
|
||||
<term>
|
||||
<parameter>apc.cache_by_default</parameter>
|
||||
<type>boolean</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
On by default, but can be set to off and used in
|
||||
conjunction with positive <literal>apc.filters</literal> so that files
|
||||
are only cached if matched by a positive filter.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry id="ini.apc.filters">
|
||||
<term>
|
||||
<parameter>apc.filters</parameter>
|
||||
<type>string</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A comma-separated list of POSIX extended regular
|
||||
expressions. If any pattern matches the source
|
||||
filename, the file will not be cached. Note that
|
||||
the filename used for matching is the one passed
|
||||
to include/require, not the absolute path. If the
|
||||
first character of the expression is a <literal>+</literal> then the
|
||||
expression will be additive in the sense that any
|
||||
files matched by the expression will be cached, and
|
||||
if the first character is a <literal>-</literal> then anything matched
|
||||
will not be cached. The <literal>-</literal> case is the default, so
|
||||
it can be left off.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry id="ini.apc.mmap-file-mask">
|
||||
<term>
|
||||
<parameter>apc.mmap_file_mask</parameter>
|
||||
<type>string</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
If compiled with MMAP support by using <literal>--enable-mmap</literal>
|
||||
this is the mktemp-style file_mask to pass to the
|
||||
mmap module for determing whether your mmap'ed memory
|
||||
region is going to be file-backed or shared memory
|
||||
backed. For straight file-backed mmap, set it to
|
||||
something like <literal>/tmp/apc.XXXXXX</literal>
|
||||
(exactly 6 <literal>X</literal>s).
|
||||
To use POSIX-style shm_open/mmap put a <literal>.shm</literal>
|
||||
somewhere in your mask. e.g. <literal>/apc.shm.XXXXXX</literal>
|
||||
You can also set it to <literal>/dev/zero</literal> to use your
|
||||
kernel's <literal>/dev/zero</literal> interface to anonymous mmap'ed
|
||||
memory. Leaving it undefined will force an anonymous mmap.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry id="ini.apc.slam-defense">
|
||||
<term>
|
||||
<parameter>apc.slam_defense</parameter>
|
||||
<type>integer</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
On very busy servers whenever you start the server or
|
||||
modify files you can create a race of many processes
|
||||
all trying to cache the same file at the same time.
|
||||
This option sets the percentage of processes that will
|
||||
skip trying to cache an uncached file. Or think of it
|
||||
as the probability of a single process to skip caching.
|
||||
For example, setting <literal>apc.slam_defense</literal>
|
||||
to <literal>75</literal> would mean that there is
|
||||
a 75% chance that the process will not cache an uncached
|
||||
file. So, the higher the setting the greater the defense
|
||||
against cache slams. Setting this to <literal>0</literal>
|
||||
disables this feature.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry id="ini.apc.file-update-protection">
|
||||
<term>
|
||||
<parameter>apc.file_update_protection</parameter>
|
||||
<type>integer</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
When you modify a file on a live web server you really
|
||||
should do so in an atomic manner. That is, write to a
|
||||
temporary file and rename (<literal>mv</literal>) the file into its
|
||||
permanent position when it is ready. Many text editors, cp, tar and
|
||||
other such programs don't do this. This means that there
|
||||
is a chance that a file is accessed (and cached) while it
|
||||
is still being written to. This <literal>apc.file_update_protection</literal>
|
||||
setting puts a delay on caching brand new files. The
|
||||
default is 2 seconds which means that if the modification
|
||||
timestamp (<literal>mtime</literal>) on a file shows that it is less than 2
|
||||
seconds old when it is accessed, it will not be cached.
|
||||
The unfortunate person who accessed this half-written file
|
||||
will still see weirdness, but at least it won't persist.
|
||||
If you are certain you always atomically update your files
|
||||
by using something like rsync which does this correctly, you
|
||||
can turn this protection off by setting it to 0. If you
|
||||
have a system that is flooded with io causing some update
|
||||
procedure to take longer than 2 seconds, you may want to
|
||||
increase this a bit.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- 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:"../../../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
|
||||
-->
|
66
reference/apc/reference.xml
Normal file
66
reference/apc/reference.xml
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<reference id="ref.apc">
|
||||
<title>Alternative PHP Cache</title>
|
||||
<titleabbrev>APC</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
<section id="apc.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
The Alternative PHP Cache (APC) is a free and open opcode cache for PHP.
|
||||
It was conceived of to provide a free, open, and robust framework for
|
||||
caching and optimizing PHP intermediate code.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="apc.installation">
|
||||
&reftitle.install;
|
||||
<para>
|
||||
&pecl.moved;
|
||||
</para>
|
||||
<para>
|
||||
&pecl.info;
|
||||
<ulink url="&url.pecl.package;apc">&url.pecl.package;apc</ulink>.
|
||||
</para>
|
||||
<para>
|
||||
&pecl.windows.download;
|
||||
</para>
|
||||
</section>
|
||||
|
||||
&reference.apc.ini;
|
||||
|
||||
<section id="apc.resources">
|
||||
&reftitle.resources;
|
||||
&no.resource;
|
||||
</section>
|
||||
|
||||
<section id="apc.constants">
|
||||
&reftitle.constants;
|
||||
&no.constants;
|
||||
</section>
|
||||
</partintro>
|
||||
|
||||
&reference.apc.functions;
|
||||
</reference>
|
||||
|
||||
<!-- 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:"../../../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
|
||||
-->
|
Loading…
Reference in a new issue