tyler.kovacs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Oct-03 23:28 UTC
memcached, marshaling and AR associations
I''m using memcached to cache many AR model objects. I''ve often wondered if the object''s associations are also stored in the memcached during marshaling. Does the act of marshaling an object automatically trigger association loads in the same way that simply referring to an association triggers a load? That would be bad if your objects had many large associations that you didn''t want to be stored. Or are only previously-loaded associations marshaled? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
If you are using CachedModel only, then no, it takes care of associations not being saved. But if you are manually marshalling data then yes. Avoid this by only saving attributes_before_typecast or better yet, only store an integer reference to your object and fetch it with a db query (memcached) on page reload. Vish On 10/4/06, tyler.kovacs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <tyler.kovacs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I''m using memcached to cache many AR model objects. I''ve often > wondered if the object''s associations are also stored in the memcached > during marshaling. Does the act of marshaling an object automatically > trigger association loads in the same way that simply referring to an > association triggers a load? That would be bad if your objects had > many large associations that you didn''t want to be stored. Or are only > previously-loaded associations marshaled? > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---