# DRb::TimerIdConv::TimerHolder2 (Class)

In: | drb/timeridconv.rb
Parent: | Object

## Methods

add fetch include? new peek

## Classes and Modules

Class DRb::TimerIdConv::TimerHolder2::InvalidIndexError

## Included Modules

MonitorMixin

## Public Class methods

new(timeout=600)

[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

add(obj)

[Source]

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

fetch(key, dv=@sentinel)

[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

include?(key)

[Source]

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

peek(key)

[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]