# Avoiding output caching, mod\_ruby/Apache?

**URL:** <https://www.ruby-forum.com/t/avoiding-output-caching-mod-ruby-apache/81426>\
**Category:** Ruby\
**Created:** [January 9, 2007, 2:13am UTC](https://www.ruby-forum.com/t/avoiding-output-caching-mod-ruby-apache/81426 "2007-01-09T02:13:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![snitko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c0e974/32.png) [@snitko](https://www.ruby-forum.com/u/snitko)\
**Post date:** [January 9, 2007, 2:13am UTC](https://www.ruby-forum.com/t/avoiding-output-caching-mod-ruby-apache/81426/1 "2007-01-09T02:13:47Z")

</div>

I got that annoying thing: all pages that are parsed by Ruby - they  
cache somehow, so that I have to restart Apache in order to see any  
changes in browser. It’s not FastCGI, because I turned it of, so that  
could be mod\_ruby, I guess. But I have no idea of how to configure it  
not to cache the output. Does anyone have a clue?

---

<div class="post-metadata">

**Author:** ![snitko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c0e974/32.png) [@snitko](https://www.ruby-forum.com/u/snitko)\
**Post date:** [January 9, 2007, 9:24pm UTC](https://www.ruby-forum.com/t/avoiding-output-caching-mod-ruby-apache/81426/2 "2007-01-09T21:24:41Z")

</div>

Roman Snitko wrote:

> I got that annoying thing: all pages that are parsed by Ruby - they  
> cache somehow, so that I have to restart Apache in order to see any  
> changes in browser. It’s not FastCGI, because I turned it of, so that  
> could be mod\_ruby, I guess. But I have no idea of how to configure it  
> not to cache the output. Does anyone have a clue?

What do you mean by “pages that are parsed by Ruby”? Do you mean code in  
.rb files or libraries, or do you mean .rhtml files which use erb,  
or…?  
If it’s code or libraries, remember that mod\_ruby is just using one  
instance of a Ruby interpreter. So, once a file is loaded, that’s the  
version it uses, just like if you were using it in IRB or a running  
program. It isn’t going to reload your code every time you make a  
change. Restarting Apache will force it to start off with a fresh  
interpreter.

Hope that helps clear it up a little bit.

-Justin

---

<div class="post-metadata">

**Author:** ![snitko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c0e974/32.png) [@snitko](https://www.ruby-forum.com/u/snitko)\
**Post date:** [January 10, 2007, 1:12am UTC](https://www.ruby-forum.com/t/avoiding-output-caching-mod-ruby-apache/81426/3 "2007-01-10T01:12:24Z")

</div>

Yeah, thanks, I think I’m getting it.

The story is, I have an .rhtml file, that requires another .rb file.  
I read, of course, that ruby ‘requires’ file only once, but i thought  
this statement takes action only during current let’s call it “page  
loading”, not during the whole session.

Will replacing ‘require’ with ‘load’ fix this?

---

<div class="post-metadata">

**Author:** ![snitko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c0e974/32.png) [@snitko](https://www.ruby-forum.com/u/snitko)\
**Post date:** [January 10, 2007, 9:12am UTC](https://www.ruby-forum.com/t/avoiding-output-caching-mod-ruby-apache/81426/4 "2007-01-10T09:12:45Z")

</div>

Roman Snitko wrote:

> Yeah, thanks, I think I’m getting it.
> 
> The story is, I have an .rhtml file, that requires another .rb file.  
> I read, of course, that ruby ‘requires’ file only once, but i thought  
> this statement takes action only during current let’s call it “page  
> loading”, not during the whole session.
> 
> Will replacing ‘require’ with ‘load’ fix this?

I’m pretty sure it will. Note that you will probably have to add “.rb”  
to the end of the file, e.g., load “myfile.rb” instead of require  
“myfile”

-Justin
