本文整理汇总了PHP中Zend_Cache_Backend::setOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Cache_Backend::setOption方法的具体用法?PHP Zend_Cache_Backend::setOption怎么用?PHP Zend_Cache_Backend::setOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Cache_Backend
的用法示例。
在下文中一共展示了Zend_Cache_Backend::setOption方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setOption
/**
* Interceptor child method to handle the case where a Model or
* Database object is being set since it's not supported by the
* standard backend interface
*
* @param string $name
* @param mixed $value
* @return void
*/
public function setOption($name, $value)
{
if ($name == 'db_object') {
$this->setDbObject($value);
} else {
parent::setOption($name, $value);
}
}
示例2: setOption
/**
* Interceptor child method to handle the case where an Inner
* Cache object is being set since it's not supported by the
* standard backend interface
*
* @param string $name
* @param mixed $value
* @return void
*/
public function setOption($name, $value)
{
if ($name == 'tag_cache') {
$this->setInnerCache($value);
} else {
parent::setOption($name, $value);
}
}
示例3: setOption
/**
* Interceptor child method to handle the case where an Inner
* Cache object is being set since it's not supported by the
* standard backend interface
*
* @param string $name
* @param mixed $value
* @return Zend_Cache_Backend_Static
*/
public function setOption($name, $value)
{
if ($name == 'tag_cache') {
$this->setInnerCache($value);
} else {
// See #ZF-12047 and #GH-91
if ($name == 'cache_file_umask') {
trigger_error("'cache_file_umask' is deprecated -> please use 'cache_file_perm' instead", E_USER_NOTICE);
$name = 'cache_file_perm';
}
if ($name == 'cache_directory_umask') {
trigger_error("'cache_directory_umask' is deprecated -> please use 'cache_directory_perm' instead", E_USER_NOTICE);
$name = 'cache_directory_perm';
}
parent::setOption($name, $value);
}
return $this;
}
示例4: setOption
/**
* Set an option
*
* @param string $name
* @param mixed $value
* @throws \Zend_Cache_Exception
* @return void
*/
public function setOption($name, $value)
{
$this->_backend->setOption($name, $value);
}
示例5: setOption
public function setOption($name, $value)
{
switch ($name) {
case 'server':
// explode list of server urls by ","
if (!is_array($value)) {
$value = explode(',', $value);
// if array key "host" exists -> this is an only one server configuration
} elseif (isset($value['host'])) {
$value = array($value);
}
$serverList = array();
foreach ($value as $k => $server) {
$serverArr = array();
// detect host:port given as array key
if (is_string($k)) {
$hostArr = explode(':', $k);
$serverArr['host'] = $hostArr[0];
if (isset($hostArr[1])) {
$serverArr['port'] = $hostArr[1];
}
}
// parse server url
if (is_string($server)) {
$serverUrlArr = @parse_url($server);
if (!$serverUrl) {
throw new Zend_Cache_Exception('Invalid server url given: ' . $server);
}
$serverArr['host'] = $serverUrl['host'];
if (isset($serverUrl['port'])) {
$serverArr['port'] = $serverUrl['port'];
}
if (isset($serverUrl['query'])) {
$queryArr = array();
parse_str($serverUrl['query'], $queryArr);
$serverArr += $queryArr;
}
}
$normalizedServerOpts = $this->_normalizeServerOptions($serverArr);
$serverKey = $normalizedServerOpts['host'] . ':' . $normalizedServerOpts['port'];
$serverList[$serverKey] = $normalizedServerOpts;
}
$value = $serverList;
if ($this->_memcached) {
// TODO: check if a simple parameter change is enough or only a new server was added.
$this->_memcached = null;
}
break;
case 'persistent':
if ($value) {
$value = self::DEFAULT_PERSISTENT_ID;
} else {
$value = false;
}
// -> no break -> handle by persistent_id
// -> no break -> handle by persistent_id
case 'persistent_id':
if (!$value) {
$value = false;
} else {
$value = (string) $value;
}
if ($value !== $this->_options['persistent_id']) {
$this->_memcached = null;
}
break;
case 'distribution':
$value = (int) $value;
if ($this->_memcached) {
$this->_memcached->setOption(Memcached::OPT_DISTRIBUTION, $value);
}
break;
case 'libketama_compatible':
$value = (bool) $value;
if ($this->_memcached) {
$this->_memcached->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, $value);
}
break;
case 'buffer_writes':
$value = (bool) $value;
if ($this->_memcached) {
$this->_memcached->setOption(Memcached::OPT_BUFFER_WRITES, $value);
}
break;
case 'binary_protocol':
$value = (bool) $value;
if ($this->_memcached) {
$this->_memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, $value);
}
break;
case 'no_block':
$value = (bool) $value;
if ($this->_memcached) {
$this->_memcached->setOption(Memcached::OPT_NO_BLOCK, $value);
}
break;
case 'tcp_nodelay':
$value = (bool) $value;
if ($this->_memcached) {
$this->_memcached->setOption(Memcached::OPT_TCP_NODELAY, $value);
//.........这里部分代码省略.........