Forum: Ruby on Rails [ANN] ActiveRecord + memcache = cached_model

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
27f8beb57f4d56d328749b51ac886d2c?d=identicon&s=25 Kian Wright (Guest)
on 2006-02-10 01:44
(Received via mailing list)
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:in
`restore'
/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:in
`session'
...
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
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 Eric Hodel (Guest)
on 2006-02-12 08:18
(Received via mailing list)
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 Hodel - drbrain@segment7.net - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
This topic is locked and can not be replied to.