Class: DRb::TimerIdConv
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
DRbIdConv
|
|
Instance Chain:
self,
DRbIdConv
|
|
Inherits: |
DRb::DRbIdConv
|
Defined in: | lib/drb/timeridconv.rb |
Overview
Timer id conversion keeps objects alive for a certain amount of time after their last access. The default time period is 600 seconds and can be changed upon initialization.
To use TimerIdConv
:
DRb.install_id_conv TimerIdConv.new 60 # one minute
Class Method Summary
-
.new(keeping = 600) ⇒ TimerIdConv
constructor
Creates a new
TimerIdConv
which will hold objects forkeeping
seconds.
Instance Method Summary
- #to_id(obj) Internal use only
- #to_obj(ref) Internal use only
DRbIdConv - Inherited
Constructor Details
.new(keeping = 600) ⇒ TimerIdConv
Creates a new TimerIdConv
which will hold objects for keeping
seconds.
# File 'lib/drb/timeridconv.rb', line 80
def initialize(keeping=600) @holder = TimerHolder2.new(keeping) end
Instance Method Details
#to_id(obj)
This method is for internal use only.
[ GitHub ]
# File 'lib/drb/timeridconv.rb', line 91
def to_id(obj) # :nodoc: return @holder.add(obj) end
#to_obj(ref)
This method is for internal use only.
[ GitHub ]
# File 'lib/drb/timeridconv.rb', line 84
def to_obj(ref) # :nodoc: return super if ref.nil? @holder.fetch(ref) rescue TimerHolder2::InvalidIndexError raise "invalid reference" end