Caching with codeigniter and twig

advertisements

I'm trying to cache my output. I'm using Codeigniter's built-in feature $this->output->cache() but it doesn't work. My guess is because I'm using twig. Any ideas?


I found the answer, may it be useful for whoever pass here.

$output = $this->twig->render('template.html'); // use render instead of display
$this->output->set_output($output); // use CI's output (autoloaded by default) manually
$this->output->cache(5); // cache for 5 minutes, doesn't matter where this line is in the function.