Class: ActiveSupport::Cache::WriteOptions
- Defined in:
- activesupport/lib/active_support/cache.rb
Overview
Enables the dynamic configuration of Cache entry options while ensuring that conflicting options are not both set. When a block is given to ActiveSupport::Cache::Store#fetch, the second argument will be an instance of WriteOptions
.
Instance Method Summary collapse
- #expires_at ⇒ Object
-
#expires_at=(expires_at) ⇒ Object
Sets the Cache entry’s
expires_at
value. - #expires_in ⇒ Object
-
#expires_in=(expires_in) ⇒ Object
Sets the Cache entry’s
expires_in
value. -
#initialize(options) ⇒ WriteOptions
constructor
:nodoc:.
- #version ⇒ Object
- #version=(version) ⇒ Object
Constructor Details
#initialize(options) ⇒ WriteOptions
:nodoc:
1122 1123 1124 |
# File 'activesupport/lib/active_support/cache.rb', line 1122 def initialize() # :nodoc: @options = end |
Instance Method Details
#expires_at ⇒ Object
1146 1147 1148 |
# File 'activesupport/lib/active_support/cache.rb', line 1146 def expires_at @options[:expires_at] end |
#expires_at=(expires_at) ⇒ Object
Sets the Cache entry’s expires_at
value. If an expires_in
option was previously set, this will unset it since expires_at
and expires_in
cannot both be set.
1153 1154 1155 1156 |
# File 'activesupport/lib/active_support/cache.rb', line 1153 def expires_at=(expires_at) @options.delete(:expires_in) @options[:expires_at] = expires_at end |
#expires_in ⇒ Object
1134 1135 1136 |
# File 'activesupport/lib/active_support/cache.rb', line 1134 def expires_in @options[:expires_in] end |
#expires_in=(expires_in) ⇒ Object
Sets the Cache entry’s expires_in
value. If an expires_at
option was previously set, this will unset it since expires_in
and expires_at
cannot both be set.
1141 1142 1143 1144 |
# File 'activesupport/lib/active_support/cache.rb', line 1141 def expires_in=(expires_in) @options.delete(:expires_at) @options[:expires_in] = expires_in end |
#version ⇒ Object
1126 1127 1128 |
# File 'activesupport/lib/active_support/cache.rb', line 1126 def version @options[:version] end |
#version=(version) ⇒ Object
1130 1131 1132 |
# File 'activesupport/lib/active_support/cache.rb', line 1130 def version=(version) @options[:version] = version end |