I have a controller that I want to exclude from the full page cache however want to cache the block rendered within the controller.

I have tried the below code however this does not seem to work:

protected function getCacheLifetime(){
    return null;

The full page cache continued with this.

I have also tried:

$this->addData(array('cache_lifetime' => null));

This however throws an error about undefined method addData()

I do not want to disable within layouts as this will disable the cache for the block. My block caching works fine and caches for however long I define.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.