How to use more than one kinds of cache?(new problem)

Hello

I want to use more than one kinds of cache.

for example, use CApcCache to cache my homepage, use CFileCache to cache the other single pages.

THX.

You need to declare multiple app components, each representing one type of cache.

Then, in COutputCache, you can specify the cacheID property.

Thanks qiang.

How to declare multiple app components? Is there any example?

Just like you do with ‘cache’ component. For example, ‘cache2’=>array(‘class’=>‘CApcCache’)

protected/config/main.php:




return array(

  'components'=>array(

     'cache'=>array(

       ...

     ),

     'cache2'=>array(

       ...

     ),

     ...

  ),

  ...

);



Thanks qiang and pestaa,I will try.

my code:

main.php:




'components'=>array(

   'cache1'=>array('class'=>'CDbCache','connectionID'=>'db'),

   'cache2'=>array('class'=>'CFileCache'),

   ....



controller:




public function filters()

{

return array(

array(

'COutputCache + list',

'duration' => 300,

),

);

}

Now,what’s the cacheID for COutputCache? cache1 or cache2 ? How to use cache2 for COutputCache?