I’ve been trying to track this down for a while now and have yet find
the solution…this problem appears only to occur in production
environment with multiple mongrels.
We’ve got several controllers using conditional action caching using
cache_fu plugin. Some actions work great, as I expect, others seem to
work intermittently at mongrel startup, but quit working after a
while.
So for example, the index action in a help controller works fine (this
is picked up by a default route):
class HelpController < ApplicationController
caches_action :index => {:ttl => 1.hour, :if => :cacheable?}
def index
end
end
However, some actions, including the main site index action seems to
fail miserably.
Uses this route:
Default welcome Route
map.home ‘’, :controller => “home”
Note - c.flash_message below is to pick up redirects to index page
with flash messages like one one logout, which will have a flash
message (“You are now logged out,” etc.)
class HomeController < ApplicationController
before_filter :login_required, :except =>
[:index, :welcome, :public_profile, :test]
before_filter :find_account_or_redirect, :except =>
[:index, :welcome, :public_profile, :test]
caches_action :index => { :ttl => 30.minutes, :if
=> :cacheable? } , :cache_path => Proc.new {|c| c.flash_message }
def index
respond_to do |format|
format.html do
unless logged_in?
@favorite = FeatureItem.recent_favorites(1, ‘entertainment’)
[0]
@favorites = FeatureItem.recent_favorites(10,
‘entertainment’)
render :action => ‘welcome’ and return false
end
.
.
.
end
end
end
.
.
.
end
cacheable? method is in application controller (logged_in? is in
restful_authentication library)
def cacheable?
logged_in? ? false : true
end
About four of the actions are working perfectly, the other four or so
fail. Any insight would be highly appreciated…