Class: Puppet::Environments::Cached::MRUEntry Private
- Defined in:
- lib/puppet/environments.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Policy that expires if it hasn’t been touched within ttl_seconds
Instance Attribute Summary
Attributes inherited from Entry
Instance Method Summary collapse
- #expired?(now) ⇒ Boolean private
-
#initialize(value, ttl_seconds) ⇒ MRUEntry
constructor
private
A new instance of MRUEntry.
- #label ⇒ Object private
- #touch ⇒ Object private
Methods inherited from Entry
Constructor Details
#initialize(value, ttl_seconds) ⇒ MRUEntry
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of MRUEntry.
580 581 582 583 584 585 586 |
# File 'lib/puppet/environments.rb', line 580 def initialize(value, ttl_seconds) super(value) @ttl = Time.now + ttl_seconds @ttl_seconds = ttl_seconds touch end |
Instance Method Details
#expired?(now) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
592 593 594 |
# File 'lib/puppet/environments.rb', line 592 def expired?(now) now > @ttl end |
#label ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
596 597 598 |
# File 'lib/puppet/environments.rb', line 596 def label "(ttl = #{@ttl_seconds} sec)" end |
#touch ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
588 589 590 |
# File 'lib/puppet/environments.rb', line 588 def touch @ttl = Time.now + @ttl_seconds end |