Conditional action-caching stops working after a period of time

0 views
Skip to first unread message

janprill

unread,
Jan 12, 2008, 9:11:29 AM1/12/08
to acts_as_cached
Hi,

first of all: thanks for cache_fu!

I've got a problem though... My three server setup with one memcache
server works for a period of time after a mongrel_rails
cluster::restart but after something between 0.5 and 1 hour the setup
caches less and less actions although the condition is met.

I'm using code like this:

caches_action :index => { :ttl => 30.minutes, :if
=> :cacheable? },
:about => { :ttl => 30.minutes, :if
=> :cacheable? },
:team => { :ttl => 30.minutes, :if
=> :cacheable? },
:jobs => { :ttl => 30.minutes, :if
=> :cacheable? }

where cacheable? is a method in application.rb that simply checks if a
user is logged_in with something like

def cacheable?
logger.info("cacheable: #{session[:user].nil?}")
session[:user].nil?
end

Even though the condition definitly is met after the described period
of time the cacheable? method not even is called on some of the
mongrels (no logging appears) while other mongrels happily continue to
get and set cached hashes.

Any idea would be greatly appreciated!! Are there any known problems
with mongrel_cluster? Might there something be happening like a
connection timeout (although nothing gets logged on the -vv running
memcached. The connections are opened flawlessly and are closed and
opened again on a restart of the mongrel_cluster)

Cheers,

Jan
Reply all
Reply to author
Forward
0 new messages