downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Memcached::setOptions> <Memcached::setMultiByKey
[edit] Last updated: Sun, 26 May 2013

view this page in

Memcached::setOption

(PECL memcached >= 0.1.0)

Memcached::setOptionEstablece una opción Memcached

Descripción

public bool Memcached::setOption ( int $option , mixed $value )

Este método establece el valor de una option Memcached. Algunas opciones corresponden a las definidas por libmemcached y otras son específicas a la extensión. Vea Constantes Memcached para más información.

Las opciones listadas más abajo requieren valores especificados via constantes.

  • Memcached::OPT_HASH require valores Memcached::HASH_*.

  • Memcached::OPT_DISTRIBUTION requiere valores Memcached::DISTRIBUTION_*.

Valores devueltos

Devuelve TRUE en caso de éxito o FALSE en caso de error.

Ejemplos

Ejemplo #1 Estableciendo una opción Memcached

<?php
$m 
= new Memcached();
var_dump($m->getOption(Memcached::OPT_HASH) == Memcached::HASH_DEFAULT);
$m->setOption(Memcached::OPT_HASHMemcached::HASH_MURMUR);
$m->setOption(Memcached::OPT_PREFIX_KEY"widgets");
echo 
"Prefix key is now: "$m->getOption(Memcached::OPT_PREFIX_KEY), "\n";
?>

El resultado del ejemplo sería:

bool(true)
Prefix key is now: widgets

Ver también



add a note add a note User Contributed Notes Memcached::setOption - [1 notes]
up
0
Harry Fuecks
2 years ago
Be warned that setting the option Memcached::OPT_DISTRIBUTION to Memcached::DISTRIBUTION_CONSISTENT can carry a significant performance hit so is best used with persistent connections. More details at http://github.com/andreiz/php-memcached/issues#issue/14

 
show source | credits | sitemap | contact | advertising | mirror sites