Class: Para::Cache::Item
Instance Method Summary
collapse
with_belongs_to_optional_option_if_needed
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.
26
27
28
|
# File 'app/models/para/cache/item.rb', line 26
def expires_at
read_attribute(:expires_at).try(:to_f)
end
|
#mismatched?(_version = nil) ⇒ Boolean
20
21
22
|
# File 'app/models/para/cache/item.rb', line 20
def mismatched?(_version = nil)
false
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
|