Hello, I want to initialize a giant hash on application startup, and have a controller interact with that hash WITHOUT having to rebuild the hash for every single request. Generating the hash will be a bit time consuming, so I want it built and immutable as soon as I launch the server. What is the "rails" way of doing this? Thank You for reading, - M --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Memcached - it is a scalable hash/dictionary that is easily shared between multiple instances. Marc Cloudcache.net Sent from my iPhone On Mar 29, 2008, at 10:17 AM, M P <spwpreston-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello, > > I want to initialize a giant hash on application startup, and have a > controller interact with that hash WITHOUT having to rebuild the hash > for every single request. Generating the hash will be a bit time > consuming, so I want it built and immutable as soon as I launch the > server. > > What is the "rails" way of doing this? > > Thank You for reading, > > > - M > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Use a session. Julian. Learn about Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) http://sensei.zenunit.com/ On 30/03/2008, at 4:17 AM, M P wrote:> > Hello, > > I want to initialize a giant hash on application startup, and have a > controller interact with that hash WITHOUT having to rebuild the hash > for every single request. Generating the hash will be a bit time > consuming, so I want it built and immutable as soon as I launch the > server. > > What is the "rails" way of doing this? > > Thank You for reading, > > > - M > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Create an initializer. Rails will load any file you dump in RAILS_ROOT/ config/initializers/ when the server starts. That, I believe, would be the most "rails way"-ish way. ;-) -Danimal P.S. Back in the early Rails days, I used to drop a lot of initialization stuff at the end of environments.rb, i.e. custom date displays, reference values, global constants, etc. Now I put ''em in an initializer... just better organized, IMHO. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---