tony2001 Tue Jul 13 06:34:04 2004 EDT Added files: /phpdoc/en/reference/memcache .cvsignore reference.xml /phpdoc/en/reference/memcache/functions Memcache-add.xml Memcache-close.xml Memcache-connect.xml Memcache-decrement.xml Memcache-delete.xml Memcache-flush.xml Memcache-get.xml Memcache-getStats.xml Memcache-getVersion.xml Memcache-increment.xml Memcache-pconnect.xml Memcache-replace.xml Memcache-set.xml memcache_debug.xml
Modified files: /phpdoc manual.xml.in /phpdoc/entities global.ent Log: add memcache docs add an entry to manual.xml.in & url to global.ent
http://cvs.php.net/diff.php/phpdoc/manual.xml.in?r1=1.178&r2=1.179&ty=u Index: phpdoc/manual.xml.in diff -u phpdoc/manual.xml.in:1.178 phpdoc/manual.xml.in:1.179 --- phpdoc/manual.xml.in:1.178 Sat Jul 10 15:37:06 2004 +++ phpdoc/manual.xml.in Tue Jul 13 06:34:03 2004 @@ -2,7 +2,7 @@ <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "@srcdir@/dtds/dbxml-4.1.2/docbookx.dtd" [ -<!-- $Revision: 1.178 $ --> +<!-- $Revision: 1.179 $ --> <!-- Add translated specific definitions and snippets --> <!ENTITY % language-defs SYSTEM "@srcdir@/@LANGDIR@/language-defs.ent"> @@ -169,6 +169,7 @@ &reference.mcal.reference; &reference.mcrypt.reference; &reference.mcve.reference; + &reference.memcache.reference; &reference.mhash.reference; &reference.mime-magic.reference; &reference.mssql.reference; http://cvs.php.net/diff.php/phpdoc/entities/global.ent?r1=1.188&r2=1.189&ty=u Index: phpdoc/entities/global.ent diff -u phpdoc/entities/global.ent:1.188 phpdoc/entities/global.ent:1.189 --- phpdoc/entities/global.ent:1.188 Thu Jul 1 16:13:16 2004 +++ phpdoc/entities/global.ent Tue Jul 13 06:34:03 2004 @@ -1,6 +1,6 @@ <!-- -*- SGML -*- - $Id: global.ent,v 1.188 2004/07/01 20:13:16 dickmeiss Exp $ + $Id: global.ent,v 1.189 2004/07/13 10:34:03 tony2001 Exp $ Contains global "macros" for all the XML documents. @@ -154,6 +154,7 @@ <!ENTITY url.mcrypt.iv "http://www.ciphersbyritter.com/GLOSSARY.HTM#IV"> <!ENTITY url.mcrypt.bcm "http://fn2.freenet.edmonton.ab.ca/~jsavard/crypto/co0409.htm"> <!ENTITY url.mdac "http://msdn.microsoft.com/data/"> +<!ENTITY url.memcache "http://www.danga.com/memcached/"> <!ENTITY url.mersenne "http://www.math.keio.ac.jp/~matumoto/emt.html"> <!ENTITY url.mhash "http://mhash.sourceforge.net/"> <!ENTITY url.ming "http://ming.sourceforge.net/"> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/.cvsignore?r=1.1&p=1 Index: phpdoc/en/reference/memcache/.cvsignore +++ phpdoc/en/reference/memcache/.cvsignore functions.xml http://cvs.php.net/co.php/phpdoc/en/reference/memcache/reference.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/reference.xml +++ phpdoc/en/reference/memcache/reference.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <reference id="ref.memcache"> <title>Memcache Functions</title> <titleabbrev>Memcache</titleabbrev> <partintro> <section id="memcache.intro"> &reftitle.intro; <para> Memcache module provides handy procedural and object oriented interface to memcached, highly effective caching daemon, which was especially designed to decrease database load in dynamic web applications. </para> <para> More information about memcached can be found at <ulink url="&url.memcached;">&url.memcached;</ulink>. </para> </section> <section id="memcache.requirements"> &reftitle.required; <para> This module uses functions of <ulink url="&url.zlib;">zlib</ulink> to support on-the-fly data compression. Zlib is required to install this module. </para> <para> PHP 4.3.3 or newer is required to use memcache extension. </para> </section> <section id="memcache.install"> &reftitle.install; <para> Memcache is currently available through PECL <ulink url="&url.pecl.package;memcache">&url.pecl.package;memcache</ulink>. </para> <para> Also you can use the pear installer to install the memcache extension, using the following command: <command>pear -v install memcache</command>. </para> <para> You can always download the tar.gz package and install memcache by hand: <example> <title>Memcache installation</title> <programlisting role="shell"> <![CDATA[ gunzip memcache-xxx.tgz tar -xvf memcache-xxx.tar cd memcache-xxx phpize /configure && make && make install ]]> </programlisting> </example> </para> <para> Windows users can download the extension dll <filename>php_memcache.dll</filename> here: <ulink url="&url.pecl.get.win;">&url.pecl.get.win;</ulink>. </para> </section> <section id="memcache.resources"> &reftitle.resources; <para> There is only one resource type used in memcache module - it's the link identifier for a cache server connection. </para> </section> <section id="memcache.constants"> &reftitle.constants; <variablelist> <varlistentry> <term> <constant>MEMCACHE_COMPRESSED</constant> (<type>integer</type>) </term> <listitem> <simpara> Used to turn on-the-fly data compression on with <function>Memcache::set</function>, <function>Memcache::add</function> and <function>Memcache::replace</function>. </simpara> </listitem> </varlistentry> </variablelist> </section> <section id="memcache.examples"> &reftitle.examples; <para> <example> <title>memcache extension overview example</title> <programlisting role="php"> <![CDATA[ <?php $memcache = new Memcache; $memcache->connect('localhost', 11211) or die ("Could not connect"); $version = $memcache->getVersion(); echo "Server's version: ".$version."<br/>\n"; $tmp_object = new stdClass; $tmp_object->str_attr = 'test'; $tmp_object->int_attr = 123; $memcache->set('key', $tmp_object, 10) or die ("Failed to save data at the server"); echo "Store data in the cache (data will expire in 10 seconds)<br/>\n"; $get_result = $memcache->get('key'); echo "Data from the cache:<br/>\n"; var_dump($get_result); ?> ]]> </programlisting> </example> </para> <para> In the above example, an object is being saved in the cache and then retrieved back. Object and other non-scalar types are serialized before saving, so it's impossible to store resources (i.e. connection identifiers and others) in the cache. </para> </section> </partintro> &reference.memcache.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 --> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/functions/Memcache-add.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/functions/Memcache-add.xml +++ phpdoc/en/reference/memcache/functions/Memcache-add.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Memcache-add"> <refnamediv> <refname>Memcache::add</refname> <refpurpose>Add an item to the server</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>Memcache::add</methodname> <methodparam><type>string</type><parameter>key</parameter></methodparam> <methodparam><type>mixed</type><parameter>var</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>flag</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>expire</parameter></methodparam> </methodsynopsis> <para> <function>Memcache::add</function> stores variable <parameter>var</parameter> with <parameter>key</parameter> only if such key doesn't exist at the server yet. <function>Memcache::add</function> returns &false; if such key already exist. For the rest <function>Memcache::add</function> behaves similarly to <function>Memcache::set</function>. </para> <para> Also you can use <function>memcache_add</function> function. See example below. </para> <example> <title><function>Memcache::add</function> example</title> <programlisting role="php"> <![CDATA[ <?php $memcache_obj = memcache_connect("localhost", 11211); /* procedural API */ memcache_add($memcache_obj, 'var_key', 'test variable', false, 30); /* OO API */ $memcache_obj->add('var_key', 'test variable', false, 30); ?> ]]> </programlisting> </example> <para> <function>Memcache::add</function> returns &true; on success or &false; on failure. </para> <para> See also <function>Memcache::set</function>, <function>Memcache::replace</function>. </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/functions/Memcache-close.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/functions/Memcache-close.xml +++ phpdoc/en/reference/memcache/functions/Memcache-close.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Memcache-close"> <refnamediv> <refname>Memcache::close</refname> <refpurpose>Close memcached server connection</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>Memcache::close</methodname> <void/> </methodsynopsis> <para> <function>Memcache::close</function> closes connection to memcached server. This function doesn't close persistent connections, which are closed only during web-server shutdown/restart. </para> <para> Also you can use <function>memcache_close</function> function. See example below. </para> <example> <title><function>Memcache::close</function> example</title> <programlisting role="php"> <![CDATA[ <?php /* procedural API */ $memcache_obj = memcache_connect('memcache_host', 11211); /* do something here .. */ memcache_close($memcache_obj); /* OO API */ $memcache_obj = new Memcache; $memcache_obj->connect('memcache_host', 11211); /* do something here .. */ $memcache_obj->close(); ?> ]]> </programlisting> </example> <para> <function>Memcache::close</function> returns &false; if an error occured. </para> <para> See also <function>Memcache::connect</function>, <function>Memcache::pconnect</function>. </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/functions/Memcache-connect.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/functions/Memcache-connect.xml +++ phpdoc/en/reference/memcache/functions/Memcache-connect.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Memcache-connect"> <refnamediv> <refname>Memcache::connect</refname> <refpurpose>Open memcached server connection</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>Memcache::connect</methodname> <methodparam><type>string</type><parameter>host</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>port</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>timeout</parameter></methodparam> </methodsynopsis> <para> <function>Memcache::connect</function> establishes a connection to the memcached server. Parameters <parameter>host</parameter> and <parameter>port</parameter> point to the host and port, where memcached is listening for connections. Parameter <parameter>port</parameter> is optional, it's default value is 11211. Also you can define a <parameter>timeout</parameter>, which will be used when connecting to the daemon. Think twice before changing the default value - you can loose all the advantages of caching if your connection is too slow. </para> <para> The connection, which was opened using <function>Memcache::connect</function> will be automatically closed at the end of script execution. Also you can close it with <function>Memcache::close</function>. </para> <para> Also you can use <function>memcache_connect</function> function. See example below. </para> <example> <title><function>Memcache::connect</function> example</title> <programlisting role="php"> <![CDATA[ <?php /* procedural API */ $memcache_obj = memcache_connect('memcache_host', 11211); /* OO API */ $memcache = new Memcache; $memcache->connect('memcache_host', 11211); ?> ]]> </programlisting> </example> <para> &return.success; </para> <para> See also <function>Memcache::pconnect</function> and <function>Memcache::close</function>. </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/functions/Memcache-decrement.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/functions/Memcache-decrement.xml +++ phpdoc/en/reference/memcache/functions/Memcache-decrement.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Memcache-decrement"> <refnamediv> <refname>Memcache::decrement</refname> <refpurpose>Decrement item's value</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>Memcache::decrement</methodname> <methodparam><type>string</type><parameter>key</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>value</parameter></methodparam> </methodsynopsis> <para> <function>Memcache::decrement</function> decrements value of the item by <parameter>value</parameter>. Similarly to <function>Memcache::increment</function>, current value of the item is being converted to numerical and after that <parameter>value</parameter> is substracted. </para> <para> Parameter <parameter>value</parameter> is optional. It's default is 1. </para> <note> <para> New item's value will not be less than zero. </para> </note> <note> <para> Do not use <function>Memcache::decrement</function> with item, which was stored compressed, because consequent call to <function>Memcache::get</function> will fail. </para> </note> <para> Also you can use <function>memcache_decrement</function> function. See example below. </para> <example> <title><function>Memcache::decrement</function> example</title> <programlisting role="php"> <![CDATA[ <?php /* procedural API */ $memcache_obj = memcache_connect('memcache_host', 11211); /* decrement item by 2 */ $new_value = memcache_decrement($memcache_obj, 'test_item', 2); /* OO API */ $memcache_obj = new Memcache; $memcache_obj->connect('memcache_host', 11211); /* decrement item by 3 */ $new_value = $memcache_obj->decrement('test_item', 3); ?> ]]> </programlisting> </example> <para> <function>Memcache::decrement</function> <emphasis>does not</emphasis> create an item if it didn't exist. </para> <para> <function>Memcache::decrement</function> returns item's new value on success or &false; on failure. </para> <para> See also <function>Memcache::increment</function>, <function>Memcache::replace</function>. </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/functions/Memcache-delete.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/functions/Memcache-delete.xml +++ phpdoc/en/reference/memcache/functions/Memcache-delete.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Memcache-delete"> <refnamediv> <refname>Memcache::delete</refname> <refpurpose>Delete item from the server</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>Memcache::delete</methodname> <methodparam><type>string</type><parameter>key</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>timeout</parameter></methodparam> </methodsynopsis> <para> <function>Memcache::delete</function> deletes item with the <parameter>key</parameter>. If parameter <parameter>timeout</parameter> is specified, the item will expire after <parameter>timeout</parameter> seconds. </para> <para> Also you can use <function>memcache_delete</function> function. See example below. </para> <example> <title><function>Memcache::delete</function> example</title> <programlisting role="php"> <![CDATA[ <?php /* procedural API */ $memcache_obj = memcache_connect('memcache_host', 11211); /* after 10 seconds item will be deleted by the server */ memcache_delete('key_to_delete', 10); /* OO API */ $memcache_obj = new Memcache; $memcache_obj->connect('memcache_host', 11211); ?> ]]> </programlisting> </example> <para> &return.success; </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/functions/Memcache-flush.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/functions/Memcache-flush.xml +++ phpdoc/en/reference/memcache/functions/Memcache-flush.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Memcache-flush"> <refnamediv> <refname>Memcache::flush</refname> <refpurpose>Flush all existing items at the server</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>Memcache::flush</methodname> <void/> </methodsynopsis> <para> <function>Memcache::flush</function> immediately invalidates all existing items. <function>Memcache::flush</function> doesn't actually free any resources, it only marks all the items as expired, so occupied memory will be overwritten by new items. </para> <para> Also you can use <function>memcache_flush</function> function. See example below. </para> <example> <title><function>Memcache::flush</function> example</title> <programlisting role="php"> <![CDATA[ <?php /* procedural API */ $memcache_obj = memcache_connect('memcache_host', 11211); memcache_flush($memcache_obj); /* OO API */ $memcache_obj = new Memcache; $memcache_obj->connect('memcache_host', 11211); $memcache_obj->flush(); ?> ]]> </programlisting> </example> <para> &return.success; </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/functions/Memcache-get.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/functions/Memcache-get.xml +++ phpdoc/en/reference/memcache/functions/Memcache-get.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Memcache-get"> <refnamediv> <refname>Memcache::get</refname> <refpurpose>Retrieve item from the server</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>mixed</type><methodname>Memcache::get</methodname> <methodparam><type>string</type><parameter>key</parameter></methodparam> </methodsynopsis> <para> <function>Memcache::get</function> returns previously stored data if an item with such <parameter>key</parameter> exists on the server at this moment. </para> <example> <title><function>Memcache::get</function> example</title> <programlisting role="php"> <![CDATA[ <?php /* procedural API */ $memcache_obj = memcache_connect('memcache_host', 11211); $var = memcache_get($memcache_obj, 'some_key'); /* OO API */ $memcache_obj = new Memcache; $memcache_obj->connect('memcache_host', 11211); $var = $memcache_obj->get('some_key'); ?> ]]> </programlisting> </example> <para> <function>Memcache::get</function> returns &false; on failure. </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/functions/Memcache-getStats.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/functions/Memcache-getStats.xml +++ phpdoc/en/reference/memcache/functions/Memcache-getStats.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Memcache-getStats"> <refnamediv> <refname>Memcache::getStats</refname> <refpurpose>Get statistics of the server</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>Memcache::getStats</methodname> <void/> </methodsynopsis> <para> <function>Memcache::getStats</function> returns an associative array with server's statistics. Array keys correspond to stats parameters and values to parameter's values. </para> <para> Also you can use <function>memcache_get_stats</function> function. </para> <para> <function>Memcache::getStats</function> returns &false; in case of an error. </para> <para> See also <function>Memcache::getVersion</function>. </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/functions/Memcache-getVersion.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/functions/Memcache-getVersion.xml +++ phpdoc/en/reference/memcache/functions/Memcache-getVersion.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Memcache-getVersion"> <refnamediv> <refname>Memcache::getVersion</refname> <refpurpose>Return version of the server</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>Memcache::getVersion</methodname> <void/> </methodsynopsis> <para> <function>Memcache::getVersion</function> returns a string with server's version number. </para> <para> Also you can use <function>memcache_get_version</function> function. See example below. </para> <example> <title><function>Memcache::getVersion</function> example</title> <programlisting role="php"> <![CDATA[ <?php /* procedural API */ $memcache_obj = memcache_connect('memcache_host', 11211); echo memcache_get_version($memcache_obj); /* OO API */ $memcache_obj = new Memcache; echo $memcache_obj->getVersion(); ?> ]]> </programlisting> </example> <para> <function>Memcache::getVersion</function> returns &false; if an error occured. </para> <para> See also <function>Memcache::getStats</function>. </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/functions/Memcache-increment.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/functions/Memcache-increment.xml +++ phpdoc/en/reference/memcache/functions/Memcache-increment.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Memcache-increment"> <refnamediv> <refname>Memcache::increment</refname> <refpurpose>Increment item's value</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>Memcache::increment</methodname> <methodparam><type>string</type><parameter>key</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>value</parameter></methodparam> </methodsynopsis> <para> <function>Memcache::increment</function> increments value of the item on the specified <parameter>value</parameter>. If item with key <parameter>key</parameter> was not numeric and cannot be converted to number, it will change it's value to <parameter>value</parameter>. </para> <para> Parameter <parameter>value</parameter> is optional. It's default value is 1. </para> <note> <para> Do not use <function>Memcache::increment</function> with item, which was stored compressed, because consequent call to <function>Memcache::get</function> will fail. </para> </note> <para> Also you can use <function>memcache_increment</function> function. See example below. </para> <example> <title><function>Memcache::increment</function> example</title> <programlisting role="php"> <![CDATA[ <?php /* procedural API */ $memcache_obj = memcache_connect('memcache_host', 11211); /* increment counter by 2 */ $current_value = memcache_increment($memcache_obj, 'counter', 2); /* OO API */ $memcache_obj = new Memcache; $memcache_obj->connect('memcache_host', 11211); /* increment counter by 3 */ $current_value = $memcache_obj->increment('counter', 3); ?> ]]> </programlisting> </example> <para> <function>Memcache::increment</function> returns new item's value on success or &false; on failure. </para> <para> <function>Memcache::increment</function> <emphasis>does not</emphasis> create an item if it didn't exist. </para> <para> See also <function>Memcache::decrement</function>, <function>Memcache::replace</function>. </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/functions/Memcache-pconnect.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/functions/Memcache-pconnect.xml +++ phpdoc/en/reference/memcache/functions/Memcache-pconnect.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Memcache-pconnect"> <refnamediv> <refname>Memcache::pconnect</refname> <refpurpose>Open memcached server persistent connection</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>Memcache::pconnect</methodname> <methodparam><type>string</type><parameter>host</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>port</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>timeout</parameter></methodparam> </methodsynopsis> <para> <function>Memcache::pconnect</function> is similar to <function>Memcache::connect</function> with the difference, that the connection it establishes is persistent. This connection is not closed after the end of script execution and by <function>Memcache::close</function> function. </para> <para> Also you can use <function>memcache_pconnect</function> function. See example below. </para> <example> <title><function>Memcache::pconnect</function> example</title> <programlisting role="php"> <![CDATA[ <?php /* procedural API */ $memcache_obj = memcache_pconnect('memcache_host', 11211); /* OO API */ $memcache_obj = new Memcache; $memcache_obj->pconnect('memcache_host', 11211); ?> ]]> </programlisting> </example> <para> &return.success; </para> <para> See also <function>Memcache::connect</function>. </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/functions/Memcache-replace.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/functions/Memcache-replace.xml +++ phpdoc/en/reference/memcache/functions/Memcache-replace.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Memcache-replace"> <refnamediv> <refname>Memcache::replace</refname> <refpurpose>Replace value of the existing item</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>Memcache::replace</methodname> <methodparam><type>string</type><parameter>key</parameter></methodparam> <methodparam><type>mixed</type><parameter>var</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>flag</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>expire</parameter></methodparam> </methodsynopsis> <para> <function>Memcache::replace</function> should be used to replace value of existing item with <parameter>key</parameter>. In case if item with such key doesn't exists, <function>Memcache::replace</function> returns &false;. For the rest <function>Memcache::replace</function> behaves similarly to <function>Memcache::set</function>. </para> <para> Also you can use <function>memcache_replace</function> function. See example below. </para> <example> <title><function>Memcache::replace</function> example</title> <programlisting role="php"> <![CDATA[ <?php $memcache_obj = memcache_connect('memcache_host', 11211); /* procedural API */ memcache_replace($memcache_obj, "test_key", "some variable", false, 30); /* OO API */ $memcache_obj->replace("test_key", "some variable", false, 30); ?> ]]> </programlisting> </example> <para> &return.success; </para> <para> See also <function>Memcache::set</function>, <function>Memcache::add</function>. </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/functions/Memcache-set.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/functions/Memcache-set.xml +++ phpdoc/en/reference/memcache/functions/Memcache-set.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.Memcache-set"> <refnamediv> <refname>Memcache::set</refname> <refpurpose>Store data at the server</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>Memcache::set</methodname> <methodparam><type>string</type><parameter>key</parameter></methodparam> <methodparam><type>mixed</type><parameter>var</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>flag</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>expire</parameter></methodparam> </methodsynopsis> <para> <function>Memcache::set</function> stores an item <parameter>var</parameter> with <parameter>key</parameter> on the memcached server. Parameter <parameter>expire</parameter> is expiration time in seconds. If it's 0, the item never expires (but memcached server doesn't guarantee this item to be stored all the time, it could be deleted from the cache to make place for other items). </para> <para> You can use <constant>MEMCACHE_COMPRESSED</constant> constant as <parameter>flag</parameter> value if you want to use on-the-fly compression (uses zlib). </para> <para> Also you can use <function>memcache_set</function> function. See example below. </para> <note> <para> Remember that resource variables (i.e. file and connection descriptors) cannot be stored in the cache, because they cannot be adequately represented in serialized state. </para> </note> <example> <title><function>Memcache::set</function> example</title> <programlisting role="php"> <![CDATA[ <?php /* procedural API */ /* connect to memcached server */ $memcache_obj = memcache_connect('memcache_host', 11211); /* set value of item with key 'var_key' using 0 as flag value, compression is not used expire time is 30 seconds */ memcache_set($memcache_obj, 'var_key', 'some variable', 0, 30); echo memcache_get($memcache_obj, 'var_key'); ?> ]]> </programlisting> </example> <example> <title><function>Memcache::set</function> example</title> <programlisting role="php"> <![CDATA[ <?php /* OO API */ $memcache_obj = new Memcache; /* connect to memcached server */ $memcache->connect('memcache_host', 11211); /* set value of item with key 'var_key', using on-the-fly compression expire time is 50 seconds */ $memcache_obj->set('var_key', 'some really big variable', MEMCACHE_COMPRESSED, 50); echo $memcache_obj->get('var_key'); ?> ]]> </programlisting> </example> <para> &return.success; </para> <para> See also <function>Memcache::add</function>, <function>Memcache::replace</function>. </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/memcache/functions/memcache_debug.xml?r=1.1&p=1 Index: phpdoc/en/reference/memcache/functions/memcache_debug.xml +++ phpdoc/en/reference/memcache/functions/memcache_debug.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.memcache-debug"> <refnamediv> <refname>memcache_debug</refname> <refpurpose>Turn debug output on/off</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>memcache_debug</methodname> <methodparam><type>int</type><parameter>on_off</parameter></methodparam> </methodsynopsis> <para> <function>memcache_debug</function> turns on debug output if parameter <parameter>on_off</parameter> is equal to 1 and turns off if it's 0. </para> <note> <para> <function>memcache_debug</function> is accessible only if PHP was built with --enable-debug option and always returns &true; in this case. Otherwise, this function has no effect and always returns &false;. </para> </note> </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 -->