Caching Queries in CakePHP
Configure Cache in app/Config/bootstrap.php Cache::config(‘long’, array( ‘engine’ => ‘File’, ‘duration’ => ‘+1 hours’, ‘probability’ => 100, ‘path’ => CACHE . ‘long’ . DS,));cache file will be written in apptmpcachelongIn controller (ArticlesController) public function latest_news ($limit=NULL) { $data = Cache::read(‘latest_news’, ‘long’); if (!$data) { $data = array(‘fields’=>array(‘id’,’title’), ‘conditions’=>array(‘Article.published’=>1), […]