Cakephp cache used to store cache of entire layout and views. It store cache in tmp/cache/views/ folder. for use cache helper we need to use the below code in our controller
var $helpers = array('cache');
and we can also give cache time for example
$this->cacheAction=array('duration'=>60);
in this code caches the action for 60 second
and for a partcular action we can use action name
public $cacheAction = array(
'view' => 36000,
'index' => 48000
);
Some time we don't want cache some part of a view we want a div or a form cache free for doing this we can use 'nocache'
<!--nocache-->
<?php if ($this->Session->check('User.id')): ?>
Welcome, <?php echo h($this->Session->read('User.username')); ?>.
<?php else: ?>
<?php echo $this->Html->link('Signin', 'users/login'); ?>
<?php endif; ?>
<!--/nocache-->
0 Comment(s)