开发者

How to set up CApcCache

I want to use APC cache in function. After setting up the config

   'cache' => array(
    'class' => 'system.caching.CApcCache',
),

but it does not work. What ever I set up to cache, it always returns false.

$result = '121';
$cache_key = 'key_12';
Yii::app开发者_如何学Go()->cache->set($cache_key,$result,300);
echo Yii::app()->cache->get($cache_key);// always return false


Dude, how much I know about apc cache, you don't need to do anything after that settings at main.php. This sets default caching to all the php codes. Now still, if you wanna do something like that, then you should try the settings like this,

'components'=>array(
    ...
    'apcCache'=>array(
                 'class'=>'CApcCache',
             ),

This may work. Give it a try.


I found some answers for you here: http://www.yiiframework.com/wiki/312/getting-the-most-out-of-apc-for-yii/ That link will show you how to get APC working with Yii! Kind regards,

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜