Class: Puppet::HTTP::DNS::CacheEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/http/dns.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#recordsObject (readonly)



8
9
10
# File 'lib/puppet/http/dns.rb', line 8

def records
  @records
end

#resolution_timeObject (readonly)



8
9
10
# File 'lib/puppet/http/dns.rb', line 8

def resolution_time
  @resolution_time
end

#ttlObject (readonly)



8
9
10
# File 'lib/puppet/http/dns.rb', line 8

def ttl
  @ttl
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