【发布时间】: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章