php教程

Memcached::setOptions

(PECL memcached >= 2.0.0)

Memcached::setOptionsSet Memcached options

说明

public Memcached::setOptions ( array $options ) : bool

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.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

Example #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_MURMURMemcached::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

参见

User Contributed Notes

There are no user contributed notes for this page.

CopyRight © 2008-2022 verySource.Com All Rights reserved. 京ICP备17048824号-1 京公网安备:11010502034788