On Aug 24, 2006, at 3:52 PM, David Vrensk wrote:

On 8/24/06, Ezra Zygmuntowicz <[EMAIL PROTECTED]> wrote:

        Memcached is indeed another option. Although it sounded like for
just one Singleton object cache that memcached would be overkill and
require yet another dependency for the app. DRb is built into ruby
and is very simple to use. So simple that he could most likely take
his singleton class and turn it into a drb server in about 4 lines of
code.

I bet I'm not the only person who would like to see those four lines of code.  Pretty please?  With a cherry on top?

/David


Hey David-

Ok you asked for it ;) Lets make a fake little singleton class to simulate what the OP has:

require 'singleton'
require 'drb'

class SingletonDRbCache
   include Singleton
   include DRbUndumped

   # rest of code here
end

DRb.start_service("druby://localhost:11111", SingletonDRbCache.instance)
DRb.thread.join


And here is the code you would need to put in environment.rb

require "drb"
DRb.start_service
SingletonDRbCache = DRbObject.new(nil, "druby://localhost:11111")


Thats pretty much it. 


-Ezra
_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to