Regarding to cookbook we can cache elements like this:
echo $this->element('helpbox', array(), array('cache' => true));
Caching with configuration is like this:
echo $this->element('helpbox', array(),
array('cache' => array('config' => 'view_long') );
How can I cache elements without predefined configuration ? How can I cache duration to elements? I tried this, but didn’t work:
echo $this->element('helpbox', array(),
array('cache' => array('time' => '+30 minutes')));
You need to configure cache in
app/Config/bootstrap.php:after this you can cache your element using defined configuration: