Class: Puppet::HTTP::DNS::CacheEntry
Instance Attribute Summary collapse
- #records ⇒ Object readonly
- #resolution_time ⇒ Object readonly
- #ttl ⇒ Object readonly
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.
10 11 12 13 14 |
# File 'lib/puppet/http/dns.rb', line 10 def initialize(records) @records = records @resolution_time = Time.now @ttl = choose_lowest_ttl(records) end |
Instance Attribute Details
#records ⇒ Object (readonly)
8 9 10 |
# File 'lib/puppet/http/dns.rb', line 8 def records @records end |
#resolution_time ⇒ Object (readonly)
8 9 10 |
# File 'lib/puppet/http/dns.rb', line 8 def resolution_time @resolution_time end |
Instance Method Details
#choose_lowest_ttl(records) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/puppet/http/dns.rb', line 16 def choose_lowest_ttl(records) ttl = records.first.ttl records.each do |rec| if rec.ttl < ttl ttl = rec.ttl end end ttl end |