Could someone give me an example about how i can cache a page for 1 hour (3600) ... ?
I want to cache my front page of the website (http://example.com), the entire page.
Thank you
Posted 08 February 2010 - 10:05 AM
Posted 08 February 2010 - 01:52 PM
function actionIndex(){
if (isset(Yii::app()->cache)){
$data = Yii::app()->cache->get('homepage');
if($data==null){
$data = $this->render('index', array(), true);
Yii::app()->cache->set('homepage', $data, 3600);
}
echo $data;
}else{
$this->render('index');
}
}
Posted 08 February 2010 - 03:43 PM