[Mongrel] MongrelCluster - How can I make a request to a specific mongrel instance?

Ezra Zygmuntowicz ezmobius at gmail.com
Thu Aug 24 19:36:52 EDT 2006


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

> On 8/24/06, Ezra Zygmuntowicz <ezmobius at gmail.com> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20060824/96b8cff0/attachment-0001.html 


More information about the Mongrel-users mailing list