Hello, I have a rails application, wich display data from database. I have a ruby script wich load rails environment and fill the database. I would like to do a cache system for the model X, while my ruby script puts data model X < ActiveRecord::Base @@cached_data = {} def after_create @@cached_data[self.id] = self end def get_cache @@cached_data end end The probleme is how make @@cached_data visible from my rails application ? --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Jason Roelofs
2008-Nov-26 15:54 UTC
Re: Class Variable accessibility in multiple rails instance
You don''t do this. If you want rails application caching, look into Memcached. Jason On Wed, Nov 26, 2008 at 10:39 AM, joserwan <joserwan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello, > > I have a rails application, wich display data from database. > I have a ruby script wich load rails environment and fill the > database. > > I would like to do a cache system for the model X, while my ruby > script puts data > > model X < ActiveRecord::Base > @@cached_data = {} > > def after_create > @@cached_data[self.id] = self > end > > def get_cache > @@cached_data > end > end > > The probleme is how make @@cached_data visible from my rails > application ? > > >--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---