My site has mostly static content other than the use of the comments
extension which itself clears the cache when the page changes. I think
it would make a great difference to the performance to set the cache
time out to a much larger value.
My understanding is that I should add a line to
MYRADIANTAPP/config/environment.rb where it says:
# Response Caching Defaults
ResponseCache.defaults[:directory] =
ActionController::Base.page_cache_directory
ResponseCache.defaults[:logger] = ActionController::Base.logger
Would that be correct?
Thanks,
Mohit.
_______________________________________________
Radiant mailing list
Post: Rad...@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant
i can't recall exactly how it worked in 0.7 (search the radiant source
for "5.minutes" and you'll find the code that controls it) but in 0.8
there is a method on SiteController called cache_timeout that you use
to set the timeout to whatever you like. i stuck
`SiteController.cache_timeout = 60.minutes` in environment.rb fired up
a rails console, ran SiteController.cache_timeout.value and sure
enough i get 3600 back.
> On Tue, Jun 30, 2009 at 11:20 PM, Mohit Sindhwani<te...@onghu.com>
> wrote:
>> Hi, just a quick question - how do I increase the page caching from 5
>> minutes to something much more?
>>
>> My site has mostly static content other than the use of the comments
>> extension which itself clears the cache when the page changes. I
>> think it
>> would make a great difference to the performance to set the cache
>> time out
>> to a much larger value.
>>
>> My understanding is that I should add a line to
>> MYRADIANTAPP/config/environment.rb where it says:
>> # Response Caching Defaults
>> ResponseCache.defaults[:directory] =
>> ActionController::Base.page_cache_directory
>> ResponseCache.defaults[:logger] = ActionController::Base.logger
>
> i can't recall exactly how it worked in 0.7 (search the radiant source
> for "5.minutes" and you'll find the code that controls it) but in 0.8
> there is a method on SiteController called cache_timeout that you use
> to set the timeout to whatever you like. i stuck
> `SiteController.cache_timeout = 60.minutes` in environment.rb fired up
> a rails console, ran SiteController.cache_timeout.value and sure
> enough i get 3600 back.
in something less than 0.8.0:
ResponseCache.defaults[:expire_time] = 12.hours
Otherwise, in 0.8.0 and greater, john is right:
SiteController.cache_timeout = 12.hours
Subscribe to the blog:
http://feeds.feedburner.com/FunWithRadiant
http://radiantcms.org/blog/archives/2009/06/08/developer-tips-responsecache-and-radiant-cache/
And why not plug my blog here too since I cover Radiant:
http://feeds2.feedburner.com/saturnflyer/blog
-Jim
Jim Gay
http://www.saturnflyer.com
Thanks John and Jim,
I did what you suggested and came up with this in
\vendor\radiant\app\models\response_cache.rb
@@defaults = {
:directory => ActionController::Base.page_cache_directory,
:expire_time => 5.minutes,
:default_extension => '.yml',
:perform_caching => true,
:logger => ActionController::Base.logger,
:use_x_sendfile => false,
:use_x_accel_redirect => false
}
So, I guess, as Jim clarified, I would need to add:
ResponseCache.defaults[:expire_time] = 12.hours
That should do it! Is anyone using really large numbers like 2400.hours?
Thanks,
Mohit.
7/2/2009 | 12:57 PM.