cvs: peardoc /en/package/caching/cache-lite/cache-lite-file cache_lite_file.xml get.xml

From: Date: Fri, 24 Jun 2005 17:23:41 +0000
Subject: cvs: peardoc /en/package/caching/cache-lite/cache-lite-file cache_lite_file.xml get.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-6391@lists.php.net to get a copy of this message
fab Fri Jun 24 13:23:41 2005 EDT Added files: /peardoc/en/package/caching/cache-lite/cache-lite-file cache_lite_file.xml get.xml Log: first commit (new Cache_Lite_File module)

http://cvs.php.net/co.php/peardoc/en/package/caching/cache-lite/cache-lite-file/cache_lite_file.xml?r=1.1&p=1 Index: peardoc/en/package/caching/cache-lite/cache-lite-file/cache_lite_file.xml +++ peardoc/en/package/caching/cache-lite/cache-lite-file/cache_lite_file.xml <!-- $Revision: 1.1 $ --> <refentry id="package.default.cache-lite.cache-lite-file.cache-lite-file"> <refnamediv> <refname>constructor <function>Cache_Lite_File::Cache_Lite_File</function></refname> <refpurpose>Constructor</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once &apos;Cache/Lite/File.php&apos;; </funcsynopsisinfo> <funcprototype> <funcdef>void constructor <function>Cache_Lite_File::Cache_Lite_File</function></funcdef> <paramdef>array <parameter>$options</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.default.cache-lite.cache-lite-file.cache-lite-file.desc"> &title.desc; <para>[since 1.5.0 beta] The constructor of the Cache_Lite_File 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-file.cache-lite-file.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.array; <parameter>$options</parameter> </term> <listitem> <para> associative array to set a lot of 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> masterFile [REQUIRED] </entry> <entry> &type.string; </entry> <entry> &apos;&apos; </entry> <entry> complete path of the file used for controlling the cache lifetime </entry> </row> <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> 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> 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> 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> max number of records to store into memory caching </entry> </row> <row> <entry> automaticCleaningFactor </entry> <entry> &type.int; </entry> <entry> 0 </entry> <entry> Disable / Tune the automatic cleaning process. The automatic cleaning process destroy too old (for the given life time) cache files when a new cache file is written. 0 means "no automatic cache cleaning", 1 means "systematic cache cleaning" (slow), x>1 means "automatic cleaning randomly 1 times on x cache writes". A value between 20 and 200 is maybe a good start. </entry> </row> <row> <entry> hashedDirectoryLevel </entry> <entry> &type.int; </entry> <entry> 0 </entry> <entry> Set the hashed directory structure level. 0 means "no hashed directory structure", 1 means "one level of directory", 2 means "two levels"... This option can speed up Cache_Lite only when you have many thousands of cache file. Only specific benchs can help you to choose the perfect value for you. Maybe, 1 or 2 is a good start. </entry> </row> </tbody> </tgroup> </table> </para> </refsect1> <refsect1 id="package.default.cache-lite.cache-lite-file.cache-lite-file.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-file/get.xml?r=1.1&p=1 Index: peardoc/en/package/caching/cache-lite/cache-lite-file/get.xml +++ peardoc/en/package/caching/cache-lite/cache-lite-file/get.xml <!-- $Revision: 1.1 $ --> <refentry id="package.caching.cache-lite.cache-lite-file.get"> <refnamediv> <refname><function>Cache_Lite_File::get</function></refname> <refpurpose>Test if a cache is available and (if yes) return it</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once &apos;Cache/Lite/File.php&apos;; </funcsynopsisinfo> <funcprototype> <funcdef>string <function>Cache_Lite_File::get</function></funcdef> <paramdef>string <parameter>$id</parameter></paramdef> <paramdef>string <parameter> <optional>$group = 'default'</optional></parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.caching.cache-lite-file.cache-lite-file.get.desc"> &title.desc; <para> test the validity of a cache file and return it if it's available (&false; else) </para> </refsect1> <refsect1 id="package.caching.cache-lite-file.cache-lite-file.get.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.string; <parameter>$id</parameter> </term> <listitem> <para> cache id </para> </listitem> </varlistentry> </variablelist> <variablelist> <varlistentry> <term> &type.string; <parameter>$group</parameter> </term> <listitem> <para> name of the cache group </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.caching.cache-lite-file.cache-lite-file.get.returns"> &title.returns; <para> <emphasis>returns</emphasis> data of the cache (or false if no cache available) </para> </refsect1> <refsect1 id="package.caching.cache-lite-file.cache-lite-file.get.note"> &title.note; &note.notstatic; </refsect1> <refsect1 id="package.caching.cache-lite-file.cache-lite-file.get.example"> &title.example; <example> <title>classical using</title> <programlisting role="php"> <![CDATA[ <?php require_once "Cache/Lite/File.php"; $options = array( 'cacheDir' => '/tmp/', 'masterFile' => '/home/web/config.xml', 'pearErrorMode' => CACHE_LITE_ERROR_DIE ); $cache = Cache_Lite($options); if ($data = $cache->get('id_of_the_page')) { // Cache hit ! // Content is in $data // (...) } else { // No valid cache found (you have to make and save the page) // (...) } ?> ]]> </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 (#6391) next »