cvs: peardoc /en/package/caching/cache-lite/cache-lite-function cache_lite_function.xml call.xml

From: Date: Tue, 27 Apr 2004 18:41:49 +0000
Subject: cvs: peardoc /en/package/caching/cache-lite/cache-lite-function cache_lite_function.xml call.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-3746@lists.php.net to get a copy of this message
fab Tue Apr 27 14:41:49 2004 EDT Added files: /peardoc/en/package/caching/cache-lite/cache-lite-function cache_lite_function.xml call.xml Log: a first commit. There is some work remaining

http://cvs.php.net/co.php/peardoc/en/package/caching/cache-lite/cache-lite-function/cache_lite_function.xml?r=1.1&p=1 Index: peardoc/en/package/caching/cache-lite/cache-lite-function/cache_lite_function.xml +++ peardoc/en/package/caching/cache-lite/cache-lite-function/cache_lite_function.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.cache-lite.cache-lite-function.cache-lite-function"> <refnamediv> <refname>constructor <function>Cache_Lite_Function::Cache_Lite_Function</function></refname> <refpurpose>Constructor</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once &apos;LiteFunction.php&apos;; </funcsynopsisinfo> <funcprototype> <funcdef>void constructor <function>Cache_Lite_Function::Cache_Lite_Function</function></funcdef> <paramdef>array <parameter> <optional>$options = array(NULL)</optional></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.default.cache-lite.cache-lite-function.cache-lite-function.desc"> &title.desc; <para>The constructor of the Cache_Lite_Output class. You can give an associative array as an argument to set a lot of options.</para> </refsect1> <refsect1 id="package.default.cache-lite.cache-lite-function.cache-lite-function.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.array; <parameter>$options</parameter> </term> <listitem> <para> options </para> </listitem> </varlistentry> </variablelist> </para> <para> <table> <title></title> <tgroup cols="4"> <thead> <row> <entry>Option</entry> <entry>Data Type</entry> <entry>Default Value</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry> cacheDir </entry> <entry> &type.string; </entry> <entry> /tmp/ </entry> <entry> directory where to put the cache file (with a trailing slash at the end) </entry> </row> <row> <entry> caching </entry> <entry> &type.bool; </entry> <entry> &true; </entry> <entry> enable / disable caching </entry> </row> <row> <entry> lifeTime </entry> <entry> &type.int; </entry> <entry> 3600 </entry> <entry> cache lifetime in seconds </entry> </row> <row> <entry> fileLocking </entry> <entry> &type.bool; </entry> <entry> &true; </entry> <entry> enable / disable fileLocking (can avoid cache corruption under bad circumstances) </entry> </row> <row> <entry> writeControl </entry> <entry> &type.bool; </entry> <entry> &true; </entry> <entry> enable / disable write control (enable write control will lightly slow the cache writing but not the cache reading, write control can detect some corrupt cache files but maybe it's not a perfect control) </entry> </row> <row> <entry> readControl </entry> <entry> &type.bool; </entry> <entry> &true; </entry> <entry> enable / disable read control (if enabled, a control key is embeded in cache file and this key is compared with the one calculated after the reading) </entry> </row> <row> <entry> readControlType </entry> <entry> &type.string; </entry> <entry> crc32 </entry> <entry> Type of read control (only if read control is enabled). Must be 'md5' (for a md5 hash control (best but slowest)), 'crc32' (for a crc32 hash control (lightly less safe but faster)) or 'strlen' (for a length only test (fastest)) </entry> </row> <row> <entry> pearErrorMode </entry> <entry> &type.int; </entry> <entry> CACHE_LITE_ERROR_RETURN </entry> <entry> pear error mode (when raiseError is called) (CACHE_LITE_ERROR_RETURN for just returning a PEAR_Error object or CACHE_LITE_ERROR_DIE for immediate stop of the script (good for debug)) </entry> </row> <row> <entry> fileNameProtection </entry> <entry> &type.bool; </entry> <entry> &true; </entry> <entry> file Name protection (if set to true, you can use any cache id or group name, if set to false, it can be faster but cache ids and group names will be used directly in cache file names so be carefull with special characters...) </entry> </row> <row> <entry> automaticSerialization </entry> <entry> &type.bool; </entry> <entry> &false; </entry> <entry> enable / disable automatic serialization (it can be used to save directly datas which aren't strings but it's slower) </entry> </row> <row> <entry> memoryCaching </entry> <entry> &type.bool; </entry> <entry> &false; </entry> <entry> [BETA QUALITY] enable / disable "Memory Caching" (NB : there is no lifetime for memory caching, only the end of the script) </entry> </row> <row> <entry> onlyMemoryCaching </entry> <entry> &type.bool; </entry> <entry> &false; </entry> <entry> [BETA QUALITY] enable / disable "Only Memory Caching" (if enabled, files are not used anymore) </entry> </row> <row> <entry> memoryCachingLimit </entry> <entry> &type.int; </entry> <entry> 1000 </entry> <entry> [BETA QUALITY] max number of records to store into memory caching </entry> </row> <row> <entry> defaultGroup </entry> <entry> &type.string; </entry> <entry> Cache_Lite_Function </entry> <entry> default cache group for function caching </entry> </row> </tbody> </tgroup> </table> </para> </refsect1> <refsect1 id="package.default.cache-lite.cache-lite-function.cache-lite-function.note"> &title.note; &note.notstatic; </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 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 --> http://cvs.php.net/co.php/peardoc/en/package/caching/cache-lite/cache-lite-function/call.xml?r=1.1&p=1 Index: peardoc/en/package/caching/cache-lite/cache-lite-function/call.xml +++ peardoc/en/package/caching/cache-lite/cache-lite-function/call.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.cache-lite.cache-lite-function.call"> <refnamediv> <refname><function>Cache_Lite_Function::call</function></refname> <refpurpose>Calls a cacheable function or method (or not if there is already a cache for it)</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once &apos;LiteFunction.php&apos;; </funcsynopsisinfo> <funcprototype> <funcdef>mixed <function>Cache_Lite_Function::call</function></funcdef> <paramdef>string<parameter>$functionName</parameter></paramdef> <paramdef>mixed<parameter>$arg1</parameter></paramdef> <paramdef>mixed<parameter>$arg2</parameter></paramdef> <paramdef>mixed<parameter>$arg3</parameter></paramdef> <paramdef>mixed<parameter>...</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.default.cache-lite.cache-lite-function.call.desc"> &title.desc; <para> call the given function with given arguments only if there is no cache about it ; else, the output of the function is read from the cache then send to the browser and the return value if read also from the cache and returned. </para> </refsect1> <refsect1 id="package.default.cache-lite.cache-lite-function.call.returns"> &title.returns; <para> <emphasis>returns</emphasis> result of the function/method </para> </refsect1> <refsect1 id="package.default.cache-lite.cache-lite-function.call.note"> &title.note; &note.notstatic; </refsect1> <refsect1 id="package.caching.cache-lite.cache-lite-function.call.example1"> &title.example; <example> <title>classical using with a function</title> <programlisting role="php"> <![CDATA[ <?php require_once('Cache/Lite/Function.php'); $options = array( 'cacheDir' => '/tmp/', 'lifeTime' => 3600 ); $cache = new Cache_Lite_Function($options); $cache->call('function_to_bench', 12, 45); function function_to_bench($arg1, $arg2) { echo "This is the output of the function function_to_bench($arg1, $arg2) !<br>"; return "This is the result of the function function_to_bench($arg1, $arg2) !<br>"; } ?> ]]> </programlisting> </example> </refsect1> <refsect1 id="package.caching.cache-lite.cache-lite-function.call.example2"> &title.example; <example> <title>classical using with a method</title> <programlisting role="php"> <![CDATA[ <?php require_once('Cache/Lite/Function.php'); $options = array( 'cacheDir' => '/tmp/', 'lifeTime' => 3600 ); $cache = new Cache_Lite_Function($options); $obj = new bench(); $obj->test = 666; $cache->call('obj->method_to_bench', 12, 45); class bench { var $test; function method_to_bench($arg1, $arg2) { echo "\$obj->test = $this->test and this is the output of the method \$obj->method_to_bench($arg1, $arg2) !<br>"; return "\$obj->test = $this->test and this is the result of the method \$obj->method_to_bench($arg1, $arg2) !<br>"; } } ?> ]]> </programlisting> </example> <para> If you try to use Cache_Lite_Function with $this object ($cache->call('this->method',...) for example), have a look first at : http://pear.php.net/bugs/bug.php?id=660 </para> </refsect1> <refsect1 id="package.caching.cache-lite.cache-lite-function.call.example3"> &title.example; <example> <title>classical using with a static method</title> <programlisting role="php"> <![CDATA[ <?php require_once('Cache/Lite/Function.php'); $options = array( 'cacheDir' => '/tmp/', 'lifeTime' => 3600 ); $cache = new Cache_Lite_Function($options); $cache->call('bench::static_method_to_bench', 12, 45); class bench { var $test; function static_method_to_bench($arg1, $arg2) { echo "This is the output of the function static_method_to_bench($arg1, $arg2) !<br>"; return "This is the result of the function static_method_to_bench($arg1, $arg2) !<br>"; } } ?> ]]> </programlisting> </example> </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 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 -->
« previous php.pear.doc (#3746) next »