Memcached::setOptions

Memcached::setOptions

(PECL memcached >= 2.0.0)

Memcached::setOptionsSet Memcached options

Description

public bool Memcached::setOptions ( array $options )

Memcached::setOptions() is a variation of the Memcached::setOption() that takes an array of options to be set.

Parameters

options

An associative array of options where the key is the option to set and the value is the new value for the option.

Return Values

Returns TRUE on success or FALSE on failure.

Examples

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_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";
?>

The above example will output:

bool(true)
bool(false)
Prefix key is now: widgets

See Also

© 1997–2017 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://secure.php.net/manual/en/memcached.setoptions.php

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部