Class: HTTPClient::LRUCache::Datum

Inherits:
Object
  • Object
show all
Defined in:
lib/httpclient/lru_cache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, expiration, soft_expiration) ⇒ Datum

Returns a new instance of Datum.



65
66
67
68
69
# File 'lib/httpclient/lru_cache.rb', line 65

def initialize(value, expiration, soft_expiration)
  @value = value
  @expiration = expiration
  @soft_expiration = soft_expiration
end

Instance Attribute Details

#expirationObject (readonly)

Returns the value of attribute expiration.



63
64
65
# File 'lib/httpclient/lru_cache.rb', line 63

def expiration
  @expiration
end

#soft_expirationObject

Returns the value of attribute soft_expiration.



63
64
65
# File 'lib/httpclient/lru_cache.rb', line 63

def soft_expiration
  @soft_expiration
end

#valueObject (readonly)

Returns the value of attribute value.



63
64
65
# File 'lib/httpclient/lru_cache.rb', line 63

def value
  @value
end

Instance Method Details

#expired?Boolean

Returns:



71
72
73
# File 'lib/httpclient/lru_cache.rb', line 71

def expired?
  !@expiration.nil? && @expiration <= Time.now
end

#soft_expired?Boolean

Returns:



75
76
77
# File 'lib/httpclient/lru_cache.rb', line 75

def soft_expired?
  !@soft_expiration.nil? && @soft_expiration <= Time.now
end