Class: Puppet::Network::Resolver::CacheEntry
- Defined in:
- lib/puppet/network/resolver.rb
Instance Attribute Summary collapse
-
#records ⇒ Object
readonly
Returns the value of attribute records.
-
#resolution_time ⇒ Object
readonly
Returns the value of attribute resolution_time.
-
#ttl ⇒ Object
readonly
Returns the value of attribute ttl.
Instance Method Summary collapse
- #choose_lowest_ttl(records) ⇒ Object
-
#initialize(records) ⇒ CacheEntry
constructor
A new instance of CacheEntry.
Constructor Details
#initialize(records) ⇒ CacheEntry
Returns a new instance of CacheEntry.
9 10 11 12 13 |
# File 'lib/puppet/network/resolver.rb', line 9 def initialize(records) @records = records @resolution_time = Time.now @ttl = choose_lowest_ttl(records) end |
Instance Attribute Details
#records ⇒ Object (readonly)
Returns the value of attribute records.
7 8 9 |
# File 'lib/puppet/network/resolver.rb', line 7 def records @records end |
#resolution_time ⇒ Object (readonly)
Returns the value of attribute resolution_time.
7 8 9 |
# File 'lib/puppet/network/resolver.rb', line 7 def resolution_time @resolution_time end |
#ttl ⇒ Object (readonly)
Returns the value of attribute ttl.
7 8 9 |
# File 'lib/puppet/network/resolver.rb', line 7 def ttl @ttl end |
Instance Method Details
#choose_lowest_ttl(records) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/puppet/network/resolver.rb', line 15 def choose_lowest_ttl(records) ttl = records.first.ttl records.each do |rec| if rec.ttl < ttl ttl = rec.ttl end end ttl end |