Class: Para::Cache::Item
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Para::Cache::Item
- Defined in:
- app/models/para/cache/item.rb
Instance Method Summary collapse
- #expired? ⇒ Boolean
-
#expires_at ⇒ Object
From ActiveSupport::Cache::Store::Entry Seconds since the epoch when the entry will expire.
- #value ⇒ Object
- #value=(new_value) ⇒ Object
Instance Method Details
#expired? ⇒ Boolean
16 17 18 |
# File 'app/models/para/cache/item.rb', line 16 def expired? read_attribute(:expires_at).try(:past?) || false end |
#expires_at ⇒ Object
From ActiveSupport::Cache::Store::Entry Seconds since the epoch when the entry will expire.
22 23 24 |
# File 'app/models/para/cache/item.rb', line 22 def expires_at read_attribute(:expires_at).try(:to_f) end |
#value ⇒ Object
7 8 9 |
# File 'app/models/para/cache/item.rb', line 7 def value Marshal.load(::Base64.decode64(self[:value])) if self[:value].present? end |
#value=(new_value) ⇒ Object
11 12 13 14 |
# File 'app/models/para/cache/item.rb', line 11 def value=(new_value) @raw_value = new_value self[:value] = ::Base64.encode64(Marshal.dump(@raw_value)) end |