Answers.Body: <p>If you're in <a href="http://buildwithcraft.com/docs/config-settings#devMode" rel="nofollow">devMode</a>, then Twig's compiled templates will be regenerated on every request.  Otherwise, they'll be regenerated when Twig sees that the source template's date modified timestamp has changed.</p>
  
  <p>As of PHP 5.5+, PHP's <a href="https://php.net/manual/en/book.opcache.php" rel="nofollow">opCache</a> is enabled by default, which might explain what you're seeing. If you're in development, you'll want to disable that to make sure PHP isn't doing any caching at the byte level.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-04T04:06:31.357Z
Answers.Text: Thanks Brad. The devMode setting makes no difference to the problem.
  
  I am running PHP5.5.9, and yes opCache is enabled. I haven't had the problem running older versions of PHP, even with devMode turned off (because as you note Twig picks up the file change). I can't turn opCache off in .htaccess in this particular instance (generates a server error), although I can with an inscript PHP command, but I haven't learned how to do that in Craft yet. Thanks for your help.
Answers.UserDisplayName: Jack McKenzie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-04T04:21:33.473Z
Answers.Text: Update: I found the plug-in called [PHP Tweak](https://github.com/lindseydiloreto/craft-phptweak), and was able to disable opCache (and reflect the setting in the template in question to show that it was indeed off). But the problem remains unfortunately.
Answers.UserDisplayName: Jack McKenzie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-04T03:44:29.173Z
Answers.LastActivityDate: 2015-04-04T03:44:29.173Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <p>Maybe a proxy on your side or reverse proxy on server-side.
  Try if adding a random number to the testpage address helps:
  <code>/test-address?rand=27456</code></p>
  
  <p>You could put a temp reload link in your testpage like this:</p>
  
  <pre><code>&lt;a href="#" onclick="location.href=location.href+'?rnd='+Math.random()"&gt;Reload&lt;/a&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-04T19:44:12.210Z
Answers.Text: Thanks. I tried that but it doesn't help either. I guess the caching is happening deep in the bowls of the template system, so even when I load different entries that use the same template I still see the cached template rather than my modified one.
Answers.UserDisplayName: Jack McKenzie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-04T14:42:16.297Z
Answers.LastActivityDate: 2015-04-04T14:42:16.297Z
Answers.UserDisplayName: phaetons
Body: <p>I'm currently developing some templates in Craft. My work flow is</p>
  
  <pre><code>&gt; Make a change to the template file
  &gt; Save the file, which automatically loads to the server
  &gt; Reload a test page in a web browser
  </code></pre>
  
  <p>About half the time, and somewhat erratically the adjusted template does not load. Once it is not loading, no amount of browser reloading, clearing local caches etc will help. The only thing that I have been able to find that will consistently fix this is to go in CP Settings and clear the Compiled Template cache. Obviously this is a pain to do each time, and slows my development time considerably.</p>
  
  <p>Initially I tried to set a Craft config of <code>'cache' =&gt; false</code>, because I read this advice somewhere, but I see it doesn't appear in the documentation, and it doesn't work. I've also tried  <code>'cacheDuration' =&gt; 'PT1S'</code> to no avail.</p>
  
  <p>The cacheMethod is set to Default. Craft version is current.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-04T03:32:34.213Z
Comments.Text: A couple questions for clarification. Are you in Dev Mode, and is this on a local server or a web host of some kind?
Comments.UserDisplayName: Bryan Redeagle
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-04T03:44:26.817Z
Comments.Text: This is on a remote web host, and most of the time I am not in Dev Mode, but have tried both with deMode set to true and false, but doesn't seem to change the behaviour I am seeing.
Comments.UserDisplayName: Jack McKenzie
Tags: <templating><cache>
Title: How can I keep the Compiled Templates from caching during development?
ThreadText: # How can I keep the Compiled Templates from caching during development?
  
  (Asked by: username_0 on 2015-04-04)
  
  I'm currently developing some templates in Craft. My work flow is
  
  ```
  > Make a change to the template file
  > Save the file, which automatically loads to the server
  > Reload a test page in a web browser
  
  ```
  
  About half the time, and somewhat erratically the adjusted template does not load. Once it is not loading, no amount of browser reloading, clearing local caches etc will help. The only thing that I have been able to find that will consistently fix this is to go in CP Settings and clear the Compiled Template cache. Obviously this is a pain to do each time, and slows my development time considerably.
  
  Initially I tried to set a Craft config of `'cache' => false`, because I read this advice somewhere, but I see it doesn't appear in the documentation, and it doesn't work. I've also tried `'cacheDuration' => 'PT1S'` to no avail.
  
  The cacheMethod is set to Default. Craft version is current.
  
  **Tags:** templating, cache
  
  > **Comments:**
  > **username_1**: A couple questions for clarification. Are you in Dev Mode, and is this on a local server or a web host of some kind?  
  > **username_0**: This is on a remote web host, and most of the time I am not in Dev Mode, but have tried both with deMode set to true and false, but doesn't seem to change the behaviour I am seeing.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-04-04. Score: 1
  
  If you're in [devMode](http://buildwithcraft.com/docs/config-settings#devMode), then Twig's compiled templates will be regenerated on every request. Otherwise, they'll be regenerated when Twig sees that the source template's date modified timestamp has changed.
  
  As of PHP 5.5+, PHP's [opCache](https://php.net/manual/en/book.opcache.php) is enabled by default, which might explain what you're seeing. If you're in development, you'll want to disable that to make sure PHP isn't doing any caching at the byte level.
  
  > **Comments:**
  > **username_0**: Thanks username_2. The devMode setting makes no difference to the problem.  I am running PHP5.5.9, and yes opCache is enabled. I haven't had the problem running older versions of PHP, even with devMode turned off (because as you note Twig picks up the file change). I can't turn opCache off in .htaccess in this particular instance (generates a server error), although I can with an inscript PHP command, but I haven't learned how to do that in Craft yet. Thanks for your help.  
  > **username_0**: Update: I found the plug-in called [PHP Tweak](https://github.com/lindseydiloreto/craft-phptweak), and was able to disable opCache (and reflect the setting in the template in question to show that it was indeed off). But the problem remains unfortunately.  
  
  ---
  
  ### Answer by username_3 on 2015-04-04. Score: 1
  
  Maybe a proxy on your side or reverse proxy on server-side.
  Try if adding a random number to the testpage address helps:
  `/test-address?rand=27456`
  
  You could put a temp reload link in your testpage like this:
  
  ```
  <a href="#" onclick="location.href=location.href+'?rnd='+Math.random()">Reload</a>
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks. I tried that but it doesn't help either. I guess the caching is happening deep in the bowls of the template system, so even when I load different entries that use the same template I still see the cached template rather than my modified one.  
  
  ---
  
  