DRb::TimerIdConv::TimerHolder2 (Class)

In: drb/timeridconv.rb
Parent: Object

Methods

add   fetch   include?   new   peek  

Included Modules

MonitorMixin

Public Class methods

[Source]

# File drb/timeridconv.rb, line 11
      def initialize(timeout=600)
        super()
        @sentinel = Object.new
        @gc = {}
        @curr = {}
        @renew = {}
        @timeout = timeout
        @keeper = keeper
      end

Public Instance methods

[Source]

# File drb/timeridconv.rb, line 21
      def add(obj)
        synchronize do 
          key = obj.__id__
          @curr[key] = obj
          return key
        end
      end

[Source]

# File drb/timeridconv.rb, line 29
      def fetch(key, dv=@sentinel)
        synchronize do 
          obj = peek(key)
          if obj == @sentinel
            return dv unless dv == @sentinel
            raise InvalidIndexError
          end
          @renew[key] = obj # KeepIt

          return obj
        end
      end

[Source]

# File drb/timeridconv.rb, line 41
      def include?(key)
        synchronize do 
          obj = peek(key)
          return false if obj == @sentinel
          true
        end
      end

[Source]

# File drb/timeridconv.rb, line 49
      def peek(key)
        synchronize do 
          return @curr.fetch(key, @renew.fetch(key, @gc.fetch(key, @sentinel)))
        end
      end

[Validate]