Caching in the Controller
Any controllers that utilize caching functionality need to include the CacheHelper in their $helpers array.
Простой текстvar $helpers = array('Cache');
You also need to indicate which actions need caching, and how long each action will be cached. This is done through the $cacheAction variable in your controllers. $cacheAction should be set to an array which contains the actions you want cached, and the duration in seconds you want those views cached. The time value can be expressed in a strtotime() format. (ie. "1 hour", or "3 minutes").
Using the example of an ArticlesController, that receives a lot of traffic that needs to be cached.
Cache frequently visited Articles for varying lengths of time
Простой текстvar $cacheAction = array('view/23/' => 21600,'view/48/' => 36000,'view/52' => 48000);
Cache an entire action in this case a large listing of articles
Простой текстvar $cacheAction = array('archives/' => '60000');
Cache every action in the controller using a strtotime() friendly time to indicate Controller wide caching time.
Простой текстvar $cacheAction = "1 hour";


Коментарии:
Добавить коментарий