Hey All ! I ended up browsing to Eric Hodel''s blog the other night, and found his entry about the new cache_model and memcache-client. Now, it looks like it''s "officially" out in the open: http://weblog.rubyonrails.com/articles/2006/01/20/caching-models-with-memcached In my application, I''ve been staying away from caching my models, and instead just doing lookups based on different ID''s that I pass around. I heard that this was a good practice, as your sessioned models could become inconsisent (ie: if it was updated). Now, it looks like this may be a moot point, as the cache_model implements ActiveRecord::Locking, and the memcache-client solves some performance issues. Is this the case ? It would indeed be *much* easier to store some models in the session, than to do lookups all over the place, so was just wondering what other people think. Let me know what you think, and forgive my ignorance if I any of my statements above are incorrect :) =Dylan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060120/26b91dae/attachment-0001.html
On Jan 20, 2006, at 2:01 PM, Dylan Stamat wrote:> I ended up browsing to Eric Hodel''s blog the other night, and found > his entry about the new cache_model and memcache-client.I don''t have a blog yet ;) Its the company''s blog.> Now, it looks like it''s "officially" out in the open: http:// > weblog.rubyonrails.com/articles/2006/01/20/caching-models-with- > memcached > > In my application, I''ve been staying away from caching my models, > and instead just doing lookups based on different ID''s that I pass > around. I heard that this was a good practice, as your sessioned > models could become inconsisent (ie: if it was updated). > > Now, it looks like this may be a moot point, as the cache_model > implements ActiveRecord::Locking, and the memcache-client solves > some performance issues. > Is this the case ?You need to add the lock_version columns to your tables if you don''t want nasty surprises in your database: Active Records support optimistic locking if the field lock_version is present. -- http://api.rubyonrails.com/classes/ActiveRecord/Locking.html> It would indeed be *much* easier to store some models in the > session, than to do lookups all over the place, so was just > wondering what other people think. > Let me know what you think, and forgive my ignorance if I any of my > statements above are incorrect :)Just store the id of the model in the session and let cached_model take care of the rest of it. No sense storing the model in memcached twice. -- Eric Hodel - drbrain@segment7.net - http://segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com
Ahh... thanks for clearing up some of the confusion I had Eric :) On 1/21/06, Eric Hodel <drbrain@segment7.net> wrote:> > On Jan 20, 2006, at 2:01 PM, Dylan Stamat wrote: > > > I ended up browsing to Eric Hodel''s blog the other night, and found > > his entry about the new cache_model and memcache-client. > > I don''t have a blog yet ;) Its the company''s blog. > > > Now, it looks like it''s "officially" out in the open: http:// > > weblog.rubyonrails.com/articles/2006/01/20/caching-models-with- > > memcached > > > > In my application, I''ve been staying away from caching my models, > > and instead just doing lookups based on different ID''s that I pass > > around. I heard that this was a good practice, as your sessioned > > models could become inconsisent (ie: if it was updated). > > > > Now, it looks like this may be a moot point, as the cache_model > > implements ActiveRecord::Locking, and the memcache-client solves > > some performance issues. > > Is this the case ? > > You need to add the lock_version columns to your tables if you don''t > want nasty surprises in your database: > > Active Records support optimistic locking if the field > lock_version is present. > > -- http://api.rubyonrails.com/classes/ActiveRecord/Locking.html > > > It would indeed be *much* easier to store some models in the > > session, than to do lookups all over the place, so was just > > wondering what other people think. > > Let me know what you think, and forgive my ignorance if I any of my > > statements above are incorrect :) > > Just store the id of the model in the session and let cached_model > take care of the rest of it. No sense storing the model in memcached > twice. > > -- > Eric Hodel - drbrain@segment7.net - http://segment7.net > This implementation is HODEL-HASH-9600 compliant > > http://trackmap.robotcoop.com > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060125/46ec3f5b/attachment.html