5 class TimerIdConv < DRbIdConv
9 class InvalidIndexError < RuntimeError; end
11 def initialize(timeout=600)
13 @sentinel = Object.new
29 def fetch(key, dv=@sentinel)
33 return dv unless dv == @sentinel
34 raise InvalidIndexError
36 @renew[key] = obj # KeepIt
44 return false if obj == @sentinel
51 return @curr.fetch(key, @renew.fetch(key, @gc.fetch(key, @sentinel)))
74 def initialize(timeout=600)
75 @holder = TimerHolder2.new(timeout)
79 return super if ref.nil?
81 rescue TimerHolder2::InvalidIndexError
82 raise "invalid reference"
86 return @holder.add(obj)
91 # DRb.install_id_conv(TimerIdConv.new)