CMemCacheServerConfiguration

CDbHttpSession

Yii Framework v1.1.10 类参考

CMemCacheServerConfiguration

system.caching
继承 class CMemCacheServerConfiguration » CComponent
源自 1.0
版本 $Id: CMemCache.php 3515 2011-12-28 12:29:24Z mdomba $
源码 framework/caching/CMemCache.php
CMemCacheServerConfiguration代表单个memcache的服务器的配置数据。

参见http://www.php.net/manual/en/function.Memcache-addServer.php 了解每个配置属性的详细解释。

公共属性

隐藏继承属性

属性类型描述定义在
host string memcache服务器主机名或者IP地址 CMemCacheServerConfiguration
persistent boolean 是否使用持久连接 CMemCacheServerConfiguration
port integer memcache服务器端口 CMemCacheServerConfiguration
retryInterval integer 重连失败服务器的频率(以秒为单位) CMemCacheServerConfiguration
status boolean 若该服务器在失败后需要标志为在线 CMemCacheServerConfiguration
timeout integer 以秒为单位的数值,连接到服务器的超时时间。 CMemCacheServerConfiguration
weight integer 在所有服务器中使用这台服务器的概率。 CMemCacheServerConfiguration

公共方法

隐藏继承方法

方法描述定义在
__call() 如果类中没有调的方法名,则调用这个方法。 CComponent
__construct() Constructor. CMemCacheServerConfiguration
__get() 返回一个属性值、一个事件处理程序列表或一个行为名称。 CComponent
__isset() 检查一个属性是否为null。 CComponent
__set() 设置一个组件的属性值。 CComponent
__unset() 设置一个组件的属性为null。 CComponent
asa() 返回这个名字的行为对象。 CComponent
attachBehavior() 附加一个行为到组件。 CComponent
attachBehaviors() 附加一个行为列表到组件。 CComponent
attachEventHandler() 为事件附加一个事件处理程序。 CComponent
canGetProperty() 确定属性是否可读。 CComponent
canSetProperty() 确定属性是否可写。 CComponent
detachBehavior() 从组件中分离一个行为。 CComponent
detachBehaviors() 从组件中分离所有行为。 CComponent
detachEventHandler() 分离一个存在的事件处理程序。 CComponent
disableBehavior() 禁用一个附加行为。 CComponent
disableBehaviors() 禁用组件附加的所有行为。 CComponent
enableBehavior() 启用一个附加行为。 CComponent
enableBehaviors() 启用组件附加的所有行为。 CComponent
evaluateExpression() 计算一个PHP表达式,或根据组件上下文执行回调。 CComponent
getEventHandlers() 返回一个事件的附加处理程序列表。 CComponent
hasEvent() 确定一个事件是否定义。 CComponent
hasEventHandler() 检查事件是否有附加的处理程序。 CComponent
hasProperty() 确定属性是否被定义。 CComponent
raiseEvent() 发起一个事件。 CComponent

属性详细

host 属性
public string $host;

memcache服务器主机名或者IP地址

persistent 属性
public boolean $persistent;

是否使用持久连接

port 属性
public integer $port;

memcache服务器端口

retryInterval 属性
public integer $retryInterval;

重连失败服务器的频率(以秒为单位)

status 属性
public boolean $status;

若该服务器在失败后需要标志为在线

timeout 属性
public integer $timeout;

以秒为单位的数值,连接到服务器的超时时间。

weight 属性
public integer $weight;

在所有服务器中使用这台服务器的概率。

方法详细

__construct() 方法
public void __construct(array $config)
$config array memcache服务器配置列表。
源码: framework/caching/CMemCache.php#264 (显示)
public function __construct($config)
{
    if(
is_array($config))
    {
        foreach(
$config as $key=>$value)
            
$this->$key=$value;
        if(
$this->host===null)
            throw new 
CException(Yii::t('yii','CMemCache server configuration must have "host" value.'));
    }
    else
        throw new 
CException(Yii::t('yii','CMemCache server configuration must be an array.'));
}

Constructor.

Copyright © 2008-2011 by Yii Software LLC
All Rights Reserved.