Class: ActiveSupport::Cache::LibmemcachedStore::FetchWithRaceConditionTTLEntry
- Inherits:
-
Object
- Object
- ActiveSupport::Cache::LibmemcachedStore::FetchWithRaceConditionTTLEntry
- Defined in:
- lib/active_support/cache/libmemcached_store.rb
Instance Attribute Summary collapse
-
#extended ⇒ Object
Returns the value of attribute extended.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #expired? ⇒ Boolean
- #expires_in ⇒ Object
-
#initialize(value, expires_in) ⇒ FetchWithRaceConditionTTLEntry
constructor
A new instance of FetchWithRaceConditionTTLEntry.
Constructor Details
#initialize(value, expires_in) ⇒ FetchWithRaceConditionTTLEntry
Returns a new instance of FetchWithRaceConditionTTLEntry.
33 34 35 36 |
# File 'lib/active_support/cache/libmemcached_store.rb', line 33 def initialize(value, expires_in) @value, @extended = value, false @expires_at = Time.now.to_i + expires_in end |
Instance Attribute Details
#extended ⇒ Object
Returns the value of attribute extended.
31 32 33 |
# File 'lib/active_support/cache/libmemcached_store.rb', line 31 def extended @extended end |
#value ⇒ Object
Returns the value of attribute value.
31 32 33 |
# File 'lib/active_support/cache/libmemcached_store.rb', line 31 def value @value end |
Instance Method Details
#expired? ⇒ Boolean
42 43 44 |
# File 'lib/active_support/cache/libmemcached_store.rb', line 42 def expired? @expires_at <= Time.now.to_i end |
#expires_in ⇒ Object
38 39 40 |
# File 'lib/active_support/cache/libmemcached_store.rb', line 38 def expires_in [@expires_at - Time.now.to_i, 1].max # never set to 0 -> never expires end |