【问题标题】:Yii: APC Cache throwing error of Servers not being configuredYii:未配置服务器的 APC 缓存抛出错误
【发布时间】:2012-10-09 13:41:09
【问题描述】:

我已经为 YII 应用程序配置了 APC 缓存,但是当我将变量放入缓存时,我在第 222 行收到以下错误:

APC Cache Error

http://i.stack.imgur.com/qu2tI.jpg

以下是我的 APC 缓存 config/main.php 条目:

        'cache'=>array(
            'class'=>'system.caching.CApcCache',
            'servers'=>array(
                    array('host'=>'localhost','port'=>11211,'weight'=>60),
                    array('host'=>'localhost','port'=>11212,'weight'=>40),
                ),
    ),

以下是我用来将数据放入缓存的代码:

    public function getReligion(){
    $lstofvals=Yii::app()->cache->get('RELIGION');
    if ($lstofvals===false){
        Yii::log('Loading Religion Data from List of Values.');
        $lstofvals=$this->PopulateLSTValsData('RELIGION');
        Yii::app()->cache->set('RELIGION', $lstofvals);
    }
    return $lstofvals;
}

我可以看到 apc.php 的输出图形和所有其他细节。

任何帮助将不胜感激。

还请确认我将基础数据存储在缓存中的策略是否正确。我是 Yii 的新手,发现 MemCache 和 APC Cache 可以很好地满足这些要求。

非常感谢, 费萨尔

【问题讨论】:

  • 图片没有上传...这里是文本错误输出:CException Property "CApcCache.servers" is not defined。 D:\yii\framework\YiiBase.php(222) $object=call_user_func_array(array($class,'newInstance'),$args); 216 } 217 } 218 否则 219 $object=new $type; 220 221 foreach($config as $key=>$value) 222 $object->$key=$value; 223 224 返回$对象;第225章

标签: yii apc


【解决方案1】:

从您的配置文件中删除整个服务器阵列。 APC 未分发。据我所知,服务器用于内存缓存

【讨论】:

  • 非常感谢。最好的问候,费萨尔
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-09-05
  • 1970-01-01
  • 2015-01-08
  • 1970-01-01
  • 2018-11-29
  • 2021-09-15
相关资源
最近更新 更多