Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>View caching, by nature, doesn't actually execute the controller's method on every request. I'm guessing it executes the action once and then caches the output to disk (or, whatever cache engine you happen to be using). If you <a href="http://api20.cakephp.org/view_source/cache-helper#l-262" rel="nofollow">look at the CacheHelper's <code>_writeFile</code> method</a>, you can see how the cached view is constructed.</p> <pre class="lang-php prettyprint-override"><code> $file = '&lt;!--cachetime:' . $cacheTime . '--&gt;&lt;?php'; if (empty($this-&gt;_View-&gt;plugin)) { $file .= " App::uses('{$this-&gt;_View-&gt;name}Controller', 'Controller'); "; } else { $file .= " App::uses('{$this-&gt;_View-&gt;plugin}AppController', '{$this-&gt;_View-&gt;plugin}.Controller'); App::uses('{$this-&gt;_View-&gt;name}Controller', '{$this-&gt;_View-&gt;plugin}.Controller'); "; } $file .= ' $request = unserialize(\'' . str_replace("'", "\\'", serialize($this-&gt;request)) . '\'); $response = new CakeResponse(array("charset" =&gt; Configure::read("App.encoding"))); $controller = new ' . $this-&gt;_View-&gt;name . 'Controller($request, $response); $controller-&gt;plugin = $this-&gt;plugin = \'' . $this-&gt;_View-&gt;plugin . '\'; $controller-&gt;helpers = $this-&gt;helpers = unserialize(base64_decode(\'' . base64_encode(serialize($this-&gt;_View-&gt;helpers)) . '\')); $controller-&gt;layout = $this-&gt;layout = \'' . $this-&gt;_View-&gt;layout . '\'; $controller-&gt;theme = $this-&gt;theme = \'' . $this-&gt;_View-&gt;theme . '\'; $controller-&gt;viewVars = unserialize(base64_decode(\'' . base64_encode(serialize($this-&gt;_View-&gt;viewVars)) . '\')); Router::setRequestInfo($controller-&gt;request); $this-&gt;request = $request;'; if ($useCallbacks == true) { $file .= ' $controller-&gt;constructClasses(); $controller-&gt;startupProcess();'; } $file .= ' $this-&gt;viewVars = $controller-&gt;viewVars; $this-&gt;loadHelpers(); extract($this-&gt;viewVars, EXTR_SKIP); ?&gt;'; </code></pre> <p>It creates a new <code>Controller</code> object (with a new CakeResponse) and loads all the helpers, plugins, etc that may be used in the view and writes it to cache.</p> <p>It appears that adding the <code>Last-Modified</code> header to the response of a cache action/view might require some deep modifications to the core CakePHP library.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload