Memached failing in 2.1 - not loading classes

Hi everyone,

We’re setting up memcached with Rails 2.1 and we’re hitting an error
with some classes. For instance:

Rails.cache.fetch(‘all_categories’) {Category.all}
ArgumentError: undefined class/module Category
from
/opt/ruby-ee/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/vendor/memcache-client-1.5.0/memcache.rb:241:in
load' from /opt/ruby-ee/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/vendor/memcache-client-1.5.0/memcache.rb:241:inget’
from
/opt/ruby-ee/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/cache/mem_cache_store.rb:26:in
read' from /opt/ruby-ee/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/cache.rb:55:infetch’
from (irb):1

If I drop into the debugger, the error comes up on line 214 in
memcache.rb:

value = Marshal.load value unless raw

When it’s loading the data, it can’t figure out what Category is.
It’s a normal model. Why isn’t it loaded at this point in the app?

Thanks,

Sean

Sent too soon. Wanted to add that if I run the cache call and watch
it fail (and it’ll fail over and over again), then just call:

Category

And then run the call again, it works.

Also, there are other models where this seems to work ok. I can’t
find the difference except that perhaps those models are being called
somewhere in the stack before the cache call is made.

Thanks,

Sean