Memcached::setOptions
(PECL memcached >= 2.0.0)
Memcached::setOptions — Set Memcached options
说明
Memcached::setOptions() is a variation of the Memcached::setOption() that takes an array of options to be set.
参数
options
An associative array of options where the key is the option to set and the value is the new value for the option.
示例
示例 #1 Setting Memcached options
<?php
$m = new Memcached();
var_dump($m->getOption(Memcached::OPT_HASH) == Memcached::HASH_DEFAULT);
$m->setOptions(array(Memcached::OPT_HASH => Memcached::HASH_MURMUR, Memcached::OPT_PREFIX_KEY => "widgets"));
var_dump($m->getOption(Memcached::OPT_HASH) == Memcached::HASH_DEFAULT);
echo "Prefix key is now: ", $m->getOption(Memcached::OPT_PREFIX_KEY), "\n";
?>以上示例会输出:
bool(true) bool(false) Prefix key is now: widgets
参见
- Memcached::getOption() - 获取 Memcached 的选项值
- Memcached::setOption() - 设置一个 memcached 选项
- Memcached Constants
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
