Sha256: 38180b9244bf8e3d9ede390ce420a0cfeb955f5041848e2581687a6b52a4d57f
Contents?: true
Size: 940 Bytes
Versions: 1
Compression:
Stored size: 940 Bytes
Contents
require 'drb' require 'glue/cache/memory' module Glue # A cached backed in a DRb server. # # === Example # # This cache needs a corresponding DRb server. Here is how you # can setup the standard Nitro Drb server to keep a DrbCache: # # require 'glue/cache/memory' # # class MyDrbServer < Nitro::DrbServer # def setup_drb_objects # .. # @my_cache = SyncHash.new # DRb.start_service("druby://#{my_drb_address}:#{my_drb_port}", @my_cache) # .. # end # end # # MyDrbServer.start class DrbCache < MemoryCache # Initialize the cache. # # === Options # # :address = The address of the DRb cache object. # :port = The port of the DRb cache object. def initialize(options = {}) c = { :address => '127.0.0.1', :port => 9080, }.update(options) @hash = DRbObject.new(nil, "druby://#{options[:address]}:#{options[:port]}") end end end # * George Moschovitis <gm@navel.gr>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
glue-0.28.0 | lib/glue/cache/drb.rb |