[Rails] Application hash?

Jarkko Laine jarkko at jlaine.net
Thu Apr 7 05:25:29 GMT 2005


Steve,

On 7.4.2005, at 08:10, Steve V wrote:

>> Any class level hash will do.  Just bear in mind that if you run more
>> than one process, you'll need to use memcached or drb or something.
>
> Something like $application = Hash.new() in environment.rb you mean?

I think he means that the hash is stored as a class variable:

class Someklass < AR::Base

   @@myhash = Hash.new

end

>
> I'm a little confused though about the multi-process issue. Are you 
> saying
> that if I'm running mod_ruby or FCGI, that the $application variable 
> would
> be shared amongst each site that I have running this application?

The issue is rather that if you run multiple fcgi processes (for a 
single site), they won't share the value of that hash unless you use 
some external storage for it.

//jarkko


--
Jarkko Laine
http://jlaine.net
http://odesign.fi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2363 bytes
Desc: not available
Url : http://one.textdrive.com/pipermail/rails/attachments/20050407/0e5570f7/smime.bin


More information about the Rails mailing list