Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • CacheHelper In CakePHP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 95
    Comment on it

    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


    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'

    <?php if ($this->Session->check('')): ?>
        Welcome, <?php echo h($this->Session->read('User.username')); ?>.
    <?php else: ?>
        <?php echo $this->Html->link('Signin', 'users/login'); ?>
    <?php endif; ?>

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: