Will creates nice web-things, builds awesome ideas, and collaborates with other creative types.

Home > Blog > Setting up a cache for a view in CakePHP 1.3 with cacheAction

Setting up a cache for a view in CakePHP 1.3 with cacheAction

by Will on Oct 29th 2010, 08:32

To Set which actions to use the view cache in the controller. use cacheAction like this:

 

Show Plain Text
  1. var $cacheAction = array(
  2.  'posts/view/' => 60000,
  3.  'posts/index/' => 60000,
  4.  'posts/latest/' => 60000,
  5. );

Note the controller, not just the action needs to be stated otherwise cake will quietly ignore you.

Then make sure you are including the Cache helper, have set Cache.check to true and Cache.disable to false in config and off you go. You can disable some parts of the view for caching using

cake:nocache
/cake:nocache

see http://book.cakephp.org/view/1380/Caching-in-the-Controller for more details.

Setting up a cache for a view in CakePHP 1.3 with cacheAction cache performance cakephp

blog comments powered by Disqus