Class: MiniCache::Data
- Inherits:
-
Object
- Object
- MiniCache::Data
- Defined in:
- lib/mini_cache/data.rb
Instance Attribute Summary collapse
-
#expires_in ⇒ Object
readonly
Returns the value of attribute expires_in.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #expired? ⇒ Boolean
-
#initialize(value, expires_in: nil) ⇒ Data
constructor
A new instance of Data.
Constructor Details
#initialize(value, expires_in: nil) ⇒ Data
Returns a new instance of Data.
8 9 10 11 |
# File 'lib/mini_cache/data.rb', line 8 def initialize(value, expires_in: nil) @value = value @expires_in = expires_in.nil? ? nil : Time.now + expires_in end |
Instance Attribute Details
#expires_in ⇒ Object (readonly)
Returns the value of attribute expires_in.
6 7 8 |
# File 'lib/mini_cache/data.rb', line 6 def expires_in @expires_in end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/mini_cache/data.rb', line 5 def value @value end |