# Deactivate page cache for development?

**URL:** <https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664>\
**Category:** Radiant CMS\
**Created:** [December 29, 2006, 6:57pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664 "2006-12-29T18:57:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 29, 2006, 6:57pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/1 "2006-12-29T18:57:10Z")

</div>

Hello list!

Is it possible to disable the page caching mechanism  
during development of a Radiant web site?

Thanks in advance!

Best regards,  
Andreas S.

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 29, 2006, 7:21pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/2 "2006-12-29T19:21:21Z")

</div>

Andreas,

I believe if you comment line 8 of environment.rb and restart your web  
server it will, be default, not cache pages.

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 30, 2006, 10:21pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/3 "2006-12-30T22:21:15Z")

</div>

Thanks!

it works …  
BUT:  
After deactivation of the caching mechanism i clicked the  
‘Clear page cache’ button … oh my!  
Only the files ‘.htaccess’ and ‘index.yml’ are still in  
the ‘public’ directory under the radiant root dir. _All_  
other files - inclusive the ‘images’ subdirectory - are  
gone. Is that a feature???

Best regards,  
Andreas S.

Ruben D. Orduz schrieb:

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 30, 2006, 10:25pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/4 "2006-12-30T22:25:18Z")

</div>

On 12/30/06, Andreas S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> After deactivation of the caching mechanism i clicked the  
> ‘Clear page cache’ button … oh my!  
> Only the files ‘.htaccess’ and ‘index.yml’ are still in  
> the ‘public’ directory under the radiant root dir. _All_  
> other files - inclusive the ‘images’ subdirectory - are  
> gone. Is that a feature???

Gee, I hope not! :-/

-M

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 30, 2006, 10:51pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/5 "2006-12-30T22:51:27Z")

</div>

errr…being in development mode should do nothing to your file  
system. That is really, really, really weird.

PS.: You all Radiantists have a happy and safe new year.

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 30, 2006, 10:33pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/6 "2006-12-30T22:33:21Z")

</div>

Mislav MarohniÄ‡ schrieb:

> Gee, I hope not! :-/

If so, then i am happy that i encountered that  
behavior during development 😉

Best regards,  
Andreas S.

Mislav MarohniÄ‡ schrieb:

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 31, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/7 "2006-12-31T14:16:33Z")

</div>

Hi Andreas,

I’m at a loss here, cause 1) am not sure why you’re losing your files  
inside RAILS\_ROOT/public and 2)am not too familiar with the  
ideocincracies of Mongrel. I run all my apps with Apache/FCGI and  
works pretty good–and it has never erased any of my files.

It’s a scary thought that a web server (Mongrel) can – and does –  
delete physical files from the file system with a change of settings.  
I’d look into Mongrel documentation, instead of Radiant, IMO.

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 31, 2006, 3:18pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/8 "2006-12-31T15:18:42Z")

</div>

Hi Ruben,

same behavior with Webrick:  
My startup command (location: ‘’):  
‘sudo ruby script/server webrick -e production’.  
The only files still in ‘/public’  
(after ‘Clear page cache’) are ‘index.yml’ and  
‘.htaccess’.  
Wanna try for yourself (i have no Apache-FCGI setup) ;-\ ?

_A happy and healthy new year to all list members!_

Best regards,  
Andreas S.

Ruben D. Orduz schrieb:

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 31, 2006, 4:56pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/9 "2006-12-31T16:56:53Z")

</div>

Andreas,

Can you try ommiting the “-e production” flag when starting either  
Mongrel or WEBrick? Or try replacing it with “-e development”? Still I  
think it’s REALLY weird that your files in public are gone…that’s  
baffling.

Happy new year to you too!

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 31, 2006, 11:54am UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/10 "2006-12-31T11:54:15Z")

</div>

@Ruben:

I have to correct something:  
My start command for Radiant is:  
‘sudo mongrel\_rails start -e production’.  
So I believe i use Radiant in ‘production mode’  
(unlike ‘development mode’), yet i developing  
the website (my meaning of ‘during  
development’). That’s not the preferred  
way of working with a Rails app, isn’t it?

However: If i deactivate the caching (in ‘environment.rb’)  
and then start Radiant with ‘sudo mongrel\_rails start -e production’  
and then click the ‘Clear page cache’ button in the admin interface  
and then loosing most files in ‘/public/’ … looks still  
like a malpractice to me.

Best regards,  
Andreas S.

Ruben D. Orduz schrieb:

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 31, 2006, 8:29pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/11 "2006-12-31T20:29:24Z")

</div>

Andreas,

I have used Radiant in all its released versions and the mental branch,  
and I can assure you that it DOES NOT delete any files in public/ for  
any reason, whether in development or production mode. Check your  
system settings, make sure that some other process, cron job or system  
tool hasn’t “cleaned” the folder. Rather than being inflammatory, it  
would help more if you could identify offending lines of code or trace  
the evidence of your problem and submit the results as a trouble ticket  
on the Trac. I’m sorry you are having difficulty with it, but we can  
help you better if you provide more information.

Sean C.  
[seancribbs.com](http://seancribbs.com)

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 31, 2006, 6:29pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/12 "2006-12-31T18:29:02Z")

</div>

@Ruben:

Not good.  
I’ve created a new Radiant site ‘test\_site’ and a mysql database  
‘test\_site’. Then i filled the development tables with  
‘script/setup\_database development’. I use the option 3, full  
featured blog. Starting: ‘mongrel\_rails start -e development’.  
I use the browser to see the new blog website, all fine.  
Then logging in to the admin interface of Radiant and change the  
blog title. Save that change (‘Save changes’) and BANG! All files in  
‘\<test\_site-root\>/public’ (except for ‘styles.css’, ‘.htaccess’,  
‘index.yml’) are gone …  
In development mode Rails caching (thus Radiant caching) is  
general deactivated.  
I believe the caching of Radiant needs some improvements.

So: _DON’T USE RADIANT IN DEVELOPMENT MODE FOR WEBSITE CONSTRUCTION!_

From the presentation of the  
‘Denver Derailed meeting September 27, 2006’ by Nathan W.:

“Please note that because Radiant is already a complete and tested  
application, we will NOT be running it in development mode; instead we  
will be using production mode.  
Radiant is signiï¬cantly faster in production mode, and it is only in  
production mode that page caching takes place.”

Greetings,  
Andreas S.

Ruben D. Orduz schrieb:

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 31, 2006, 8:51pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/13 "2006-12-31T20:51:26Z")

</div>

I agree with Sean. I have used both development and production modes  
liberally and hitherto it has worked flawlessly and have not lost ANY  
files and have not lost ANY DB records. I’m fairly sure it is not a  
Radiant issue (at least not as direct consequence).

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 31, 2006, 9:29pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/14 "2006-12-31T21:29:33Z")

</div>

It is possible that it was using #{RAILS\_ROOT}/public as the cache  
directory and clearing the cache deleted items in your /public  
directory. In development mode you should see changes immediately, but  
even so, I would say put that line back in environment.rb and see what  
happens.

Cheers,  
Sean

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 31, 2006, 9:09pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/15 "2006-12-31T21:09:30Z")

</div>

@Sean,  
@Ruben,

it was not my intent to be inflammatory, really.  
Please consider: I’ve commented out line 44 of  
‘config/environment.rb’ (line 44:  
config.action\_controller.page\_cache\_directory = “#{RAILS\_ROOT}/cache”).  
Perhaps that is a subtle distinction to your setup. I made that to see  
changes in children of pages without clicking ‘Clear page cache’ first.

If i have time i will look at the source code (after finishing the  
client project).

Best regards,  
Andreas S.

Sean C. schrieb:

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 31, 2006, 9:47pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/16 "2006-12-31T21:47:39Z")

</div>

@Sean,

yes, I’ve put line 44 back in ‘environment.rb’ and all seems fine.  
Now - where i know that development mode gives me instant feedbacks -  
i will use development mode during development of my Radiant website  
(without doubt that makes sense …).  
Sorry for all the traffic here.

Best regards and a happy new year,  
Andreas S.

P.S.: Is it possible to verify your assumption with the rails console  
(‘script/console’)?

Sean C. schrieb:

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 31, 2006, 10:05pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/17 "2006-12-31T22:05:40Z")

</div>

Yes,

Andreas S. wrote:

> Andreas S.
> 
> P.S.: Is it possible to verify your assumption with the rails console  
> (‘script/console’)?

Yes, you can verify where it puts the cache in script/console with this  
line:

puts ActionController::Base.page\_cache\_directory

Cheers,

Sean

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 31, 2006, 10:37pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/18 "2006-12-31T22:37:51Z")

</div>

@Sean,

## line 44 of ‘config/environment.rb’ _in_:

> > puts ActionController::Base.page\_cache\_directory  
> > script/…/config/…/config/…/cache  
> > =\> nil

* * *

## line 44 of ‘config/environment.rb’ _out_:

> > puts ActionController::Base.page\_cache\_directory  
> > script/…/config/…/config/…/public  
> > =\> nil

* * *

You’re right! Thanks! No more mystery for me!  
… now i can eat my quiche 🙂

Best regards,  
Andreas S.

Sean C. schrieb:

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 31, 2006, 11:18pm UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/19 "2006-12-31T23:18:01Z")

</div>

Okay, ‘Agile Web D. with Rails’ (First Edition), page 335  
says:  
“Page cache files are by default stored in the public directory of  
your application.”

Perhaps it would be nice to include a warning in ‘config/environment.rb’  
NOT to comment out line 44 … to avoid such mail threads 😉  
(Or perhaps it would be nice to have educated users …)

Best regards,  
Andreas S.

Andreas S. schrieb:

---

<div class="post-metadata">

**Author:** ![andreas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee7513/32.png) [@andreas](https://www.ruby-forum.com/u/andreas)\
**Post date:** [December 17, 2008, 2:48am UTC](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664/20 "2008-12-17T02:48:24Z")

</div>

Andreas S. wrote:

> Okay, ‘Agile Web D. with Rails’ (First Edition), page 335  
> says:  
> “Page cache files are by default stored in the public directory of  
> your application.”
> 
> Perhaps it would be nice to include a warning in ‘config/environment.rb’  
> NOT to comment out line 44 … to avoid such mail threads 😉  
> (Or perhaps it would be nice to have educated users …)

I just experienced this too. So how do I disable page caching without  
erasing my public directory contents?

Thanks,  
Steve

[Next page](https://www.ruby-forum.com/t/deactivate-page-cache-for-development/80664.md?page=2)
