Class: PuppetX::Wmflib::DNS::CacheEntry

Inherits:
Object
  • Object
show all
Defined in:
modules/wmflib/lib/puppet_x/wmflib/dns.rb

Instance Method Summary collapse

Constructor Details

#initialize(entry, ttl) ⇒ CacheEntry

Data structure for storing a DNS cached result.



21
22
23
24
# File 'modules/wmflib/lib/puppet_x/wmflib/dns.rb', line 21

def initialize(entry, ttl)
  @value = entry
  @ttl = Time.now.to_i + ttl
end

Instance Method Details

#valid?(time) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'modules/wmflib/lib/puppet_x/wmflib/dns.rb', line 26

def valid?(time)
  @ttl > time
end

#valueObject



30
31
32
# File 'modules/wmflib/lib/puppet_x/wmflib/dns.rb', line 30

def value
  @value.to_s
end