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: Thu, 23 May 2013

view this page in

Memcached::setOption

(PECL memcached >= 0.1.0)

Memcached::setOptionConfigure une option Memcached

Description

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

Memcached::setOption() configure une valeur de l'option Memcached option avec la valeur value. Certaines options correspondent à celles définies dans libmemcached, et d'autres sont spécifiques à l'extension. Voyez les constantes Memcached pour plus d'informations.

Les options listées ci-dessous requièrent des valeurs fournies par les constantes :

  • Memcached::OPT_HASH requiert une constante Memcached::HASH_*.

  • Memcached::OPT_DISTRIBUTION requiert une constante Memcached::DISTRIBUTION_*.

Valeurs de retour

Cette fonction retourne TRUE en cas de succès ou FALSE si une erreur survient.

Exemples

Exemple #1 Configuration d'une option 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 
"Le préfixe de la clé est maintenant : "$m->getOption(Memcached::OPT_PREFIX_KEY), "\n";
?>

L'exemple ci-dessus va afficher :

bool(true)
Le préfixe de la clé est maintenant : widgets

Voir aussi



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