php-doc-en/reference/memcache/functions/memcache-connect.xml
Antony Dovgal a8e5f35d21 convert all filenames to lowercase
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@169434 c90b9560-bf6c-de11-be94-00142212c4b1
2004-09-28 12:23:52 +00:00

86 lines
2.5 KiB
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
-->