Class: Cream::CacheItem
- Inherits:
-
Object
- Object
- Cream::CacheItem
- Defined in:
- lib/cream/cache_item.rb
Instance Attribute Summary collapse
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #expired? ⇒ Boolean
-
#initialize(value, expires_at) ⇒ CacheItem
constructor
A new instance of CacheItem.
Constructor Details
#initialize(value, expires_at) ⇒ CacheItem
Returns a new instance of CacheItem.
5 6 7 8 |
# File 'lib/cream/cache_item.rb', line 5 def initialize(value, expires_at) @value = value @expires_at = expires_at end |
Instance Attribute Details
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
3 4 5 |
# File 'lib/cream/cache_item.rb', line 3 def expires_at @expires_at end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/cream/cache_item.rb', line 3 def value @value end |
Instance Method Details
#expired? ⇒ Boolean
10 11 12 |
# File 'lib/cream/cache_item.rb', line 10 def expired? Time.now > expires_at end |