开发者

How to set up CApcCache

开发者 https://www.devze.com 2023-04-04 13:23 出处:网络
I want to use APC cache in function. After setting up the config \'cache\' => array( \'class\' => \'system.caching.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

精彩评论

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

关注公众号