Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Cache views and flashSession: Workflow

What should be the workflow for caching views containing flashSession? I think we have to disable the cache if there is a flashSession.



18.8k
Accepted
answer

I think this code behaves well:

if (!$this->flashSession->has()) {
        if ($this->request->isGet()) {
            $this->view->cache(
                array(
                    "lifetime" => 3600,
                    "key" => $cacheKey
                )
            );
        }
    }