<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="memcached.setoption" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>Memcached::setOption</refname>
  <refpurpose>Set a Memcached option</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="Memcached">
   <modifier>public</modifier> <type>bool</type><methodname>Memcached::setOption</methodname>
   <methodparam><type>int</type><parameter>option</parameter></methodparam>
   <methodparam><type>mixed</type><parameter>value</parameter></methodparam>
  </methodsynopsis>
  <para>
   This method sets the value of a Memcached <parameter>option</parameter>.
   Some options correspond to the ones defined by libmemcached, and some are
   specific to the extension.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>option</parameter></term>
     <listitem>
      <para>
       One of the <literal>Memcached::OPT_*</literal> constant.
       See <link linkend="memcached.constants">Memcached Constants</link> for more information.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>value</parameter></term>
     <listitem>
      <para>
       The value to be set.
      </para>
      <note>
       <para>
        The options listed below require values specified via constants.
        <simplelist>
         <member><literal>Memcached::OPT_HASH</literal> requires <literal>Memcached::HASH_*</literal> values.</member>
         <member><literal>Memcached::OPT_DISTRIBUTION</literal> requires <literal>Memcached::DISTRIBUTION_*</literal> values.</member>
        </simplelist>
       </para>
      </note>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success;
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Setting a Memcached option</title>
    <programlisting role="php">
<![CDATA[
<?php
$m = new Memcached();
var_dump($m->getOption(Memcached::OPT_HASH) == Memcached::HASH_DEFAULT);
$m->setOption(Memcached::OPT_HASH, Memcached::HASH_MURMUR);
$m->setOption(Memcached::OPT_PREFIX_KEY, "widgets");
echo "Prefix key is now: ", $m->getOption(Memcached::OPT_PREFIX_KEY), "\n";
?>
]]>
    </programlisting>
    &example.outputs;
    <screen>
<![CDATA[
bool(true)
Prefix key is now: widgets
]]>
    </screen>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><methodname>Memcached::getOption</methodname></member>
    <member><methodname>Memcached::setOptions</methodname></member>
    <member><link linkend="memcached.constants">Memcached Constants</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:"~/.phpdoc/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
-->
