Class: Async::DNS::Cache::Entry
- Inherits:
-
Struct
- Object
- Struct
- Async::DNS::Cache::Entry
- Defined in:
- lib/async/dns/cache.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#resource_class ⇒ Object
Returns the value of attribute resource_class.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Instance Method Summary collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
10 11 12 |
# File 'lib/async/dns/cache.rb', line 10 def name @name end |
#resource ⇒ Object
Returns the value of attribute resource
10 11 12 |
# File 'lib/async/dns/cache.rb', line 10 def resource @resource end |
#resource_class ⇒ Object
Returns the value of attribute resource_class
10 11 12 |
# File 'lib/async/dns/cache.rb', line 10 def resource_class @resource_class end |
#timestamp ⇒ Object
Returns the value of attribute timestamp
10 11 12 |
# File 'lib/async/dns/cache.rb', line 10 def end |
Instance Method Details
#age(now) ⇒ Object
11 12 13 |
# File 'lib/async/dns/cache.rb', line 11 def age(now) now - end |
#fresh?(now = Async::Clock.now) ⇒ Boolean
15 16 17 18 19 20 21 |
# File 'lib/async/dns/cache.rb', line 15 def fresh?(now = Async::Clock.now) if ttl = resource.ttl self.age(now) <= ttl else true end end |