On 20 Jan 2009, at 05:03, Greg Hauptmann wrote:

> Hi,
>
> Class variables in a model are ok to cache relatively static records  
> within the scope of a brower call aren't they?  That is, the results  
> get "refreshed" effectively each browser call (i.e. per browser  
> call, per mongrel process).  Example of what I'm talking about is  
> below.
>
>   @@all_records = nil
>   def self.all_records
>     @@all_records ||= Automatch.find(:all)      # say only 10  
> records, relatively static
>   end

In development yes, since the class is reloaded. In production no  
since the class isn't reloaded so @@all_record is only ever set once  
(minus potential race conditions upon initialization)

Fred
>
>
>
> -- 
> Greg
> http://blog.gregnet.org/
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to