Class: HTTPClient::LRUCache::Datum
- Inherits:
-
Object
- Object
- HTTPClient::LRUCache::Datum
- Defined in:
- lib/httpclient/lru_cache.rb
Instance Attribute Summary collapse
-
#expiration ⇒ Object
readonly
Returns the value of attribute expiration.
-
#soft_expiration ⇒ Object
Returns the value of attribute soft_expiration.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #expired? ⇒ Boolean
-
#initialize(value, expiration, soft_expiration) ⇒ Datum
constructor
A new instance of Datum.
- #soft_expired? ⇒ Boolean
Constructor Details
#initialize(value, expiration, soft_expiration) ⇒ Datum
Returns a new instance of Datum.
62 63 64 65 66 |
# File 'lib/httpclient/lru_cache.rb', line 62 def initialize(value, expiration, soft_expiration) @value = value @expiration = expiration @soft_expiration = soft_expiration end |
Instance Attribute Details
#expiration ⇒ Object (readonly)
Returns the value of attribute expiration.
60 61 62 |
# File 'lib/httpclient/lru_cache.rb', line 60 def expiration @expiration end |
#soft_expiration ⇒ Object
Returns the value of attribute soft_expiration.
60 61 62 |
# File 'lib/httpclient/lru_cache.rb', line 60 def soft_expiration @soft_expiration end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
60 61 62 |
# File 'lib/httpclient/lru_cache.rb', line 60 def value @value end |
Instance Method Details
#expired? ⇒ Boolean
68 69 70 |
# File 'lib/httpclient/lru_cache.rb', line 68 def expired? !@expiration.nil? && @expiration <= Time.now end |
#soft_expired? ⇒ Boolean
72 73 74 |
# File 'lib/httpclient/lru_cache.rb', line 72 def soft_expired? !@soft_expiration.nil? && @soft_expiration <= Time.now end |