Class: Puppet::Environments::Cached::TTLEntry Private

Inherits:
Entry show all
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.

Time to Live eviction policy entry

Instance Attribute Summary

Attributes inherited from Entry

#value

Instance Method Summary collapse

Constructor Details

#initialize(value, ttl_seconds) ⇒ TTLEntry

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 TTLEntry.



468
469
470
471
472
# File 'lib/puppet/environments.rb', line 468

def initialize(value, ttl_seconds)
  super value
  @ttl = Time.now + ttl_seconds
  @ttl_seconds = ttl_seconds
end

Instance Method Details

#expired?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.

Returns:

  • (Boolean)


474
475
476
# File 'lib/puppet/environments.rb', line 474

def expired?
  Time.now > @ttl
end

#expiresObject

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.



482
483
484
# File 'lib/puppet/environments.rb', line 482

def expires
  @ttl
end

#labelObject

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.



478
479
480
# File 'lib/puppet/environments.rb', line 478

def label
  "(ttl = #{@ttl_seconds} sec)"
end