[ANN] ActiveRecord + memcache = cached_model

CachedModel looks like a great idea. Thanks for contributing it.

Do you have to have all of your models derived from CachedModel and
running through the cache? Or
can I do only selective ones (hopefully)?

I tried just switching one model over to CachedModel, and I get an
‘undefined class/module’ error
on another model. But that’s the User model, which is stored in the
session. I didn’t think I was
caching sessions using memcached, but maybe I am…

/usr/lib/ruby/gems/1.8/gems/memcache-client-1.0.3/lib/memcache.rb:128:in
get' ... /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/session/mem_cache_store.rb:59:inrestore’
/usr/lib/ruby/1.8/cgi/session.rb:305:in []' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/cgi_process.rb:104:insession’

Looks like it is correctly finding the user, logging the user in, and
writing a last login time to
the database. But then it redirects and tries to pull the user object
out of the session and
fails. Does CachedModel / memcache-client conflict with session storage?

So maybe this is a session problem? Or is it having a problem
instantiating the User object pulled
out of the cache when User is derived from ActiveRecord::Base, not
CachedModel?

Thanks,
KW

On Feb 9, 2006, at 4:44 PM, Kian Wright wrote:

Do you have to have all of your models derived from CachedModel and
running through the cache? Or can I do only selective ones
(hopefully)?

You can be selective if you like.

I tried just switching one model over to CachedModel, and I get an
‘undefined class/module’ error on another model. But that’s the
User model, which is stored in the session. I didn’t think I was
caching sessions using memcached, but maybe I am…

You should check your configuration to see if you’re using memcached
for sessions.

/usr/lib/ruby/gems/1.8/gems/memcache-client-1.0.3/lib/memcache.rb:
128:in `get’

Using dots removes critical information.

storage?
It depends. You may have a version of cached_model with bugs.

So maybe this is a session problem? Or is it having a problem
instantiating the User object pulled out of the cache when User is
derived from ActiveRecord::Base, not CachedModel?

Provide the missing information and I might be able to provide a
solution.

PS: Use a relevant subject or use ‘Re:’ if you’re replying to something.


Eric H. - [email protected] - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com