Completely Disable Cache For Dev

First off, I am completely brand new to yii, and my initial views of it are promising… until i hit this issue…

I have searched and seen others post "solutions" to this, but none work for me.

My set up is a completely fresh install of yii (only modding the index.php to show php errors and put yii in debug mode) using MAMP.

I open up view/site/index.php and put:

<h3>cache test 1</h3>

<h3><?php echo date('m/d/Y h:i:s a', time()) ?></h3>

… at the bottom and save. Refresh and i see what is expected. I change "cache test 1" to "cache test 2" and it does not update, but the PHP date echo updates. A minute of so later, the update gets applied.

I have tried adding:

'cache' => array(

	'class' => 'system.caching.CDummyCache'


… to the components array in main.php but it seems to do nothing. I have even tried to add:

Yii::app()->setComponent('cache', new CDummyCache()); 

… to the CController.php file in framework, but that also does not solve this problem…

The HTTP response is as expected, decorated with the proper ‘no-cache’:

Cache-Control →


Tells all caching mechanisms from server to client whether they may cache this object. It is measured in seconds

no-store, no-cache, must-revalidate, post-check=0, pre-check=0

Connection →Keep-Alive

Content-Length →2329

Content-Type →text/html

Date →Fri, 21 Feb 2014 11:35:13 GMT

Expires →Thu, 19 Nov 1981 08:52:00 GMT

Keep-Alive →timeout=5, max=100

Pragma →no-cache

Server →Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/0.9.8y DAV/2 PHP/5.5.3

X-Powered-By →PHP/5.5.3

So the question is, how do the yii guru’s dev under these conditions? There has to be solution to this instead of waiting a minute to see your changes :)

Thanks :)

seems like cache/ttl in your php opcode cacher (APC, eAccelerator, etc) - only opcode cacher can delay ‘seeing’ physical changes in files on disk when there is CDummyCache in your app and template is rendered every time (time on rendered view changes)

You are correct in that is beyond the scope of yii. I just created a blah.php and performed the similar test and the problem persists. Now time to figure out how to disable it :)


Your answer pointed me in the right direction, I thank you! :)

Here is the solution for anyone having this issue with MAMP: