Class: ActiveSupport::Cache::WriteOptions
Relationships & Source Files | |
Inherits: | Object |
Defined in: | activesupport/lib/active_support/cache.rb |
Overview
Enables the dynamic configuration of ::ActiveSupport::Cache
entry options while ensuring that conflicting options are not both set. When a block is given to Store#fetch, the second argument will be an instance of WriteOptions
.
Class Method Summary
- .new(options) ⇒ WriteOptions constructor Internal use only
Instance Attribute Summary
- #expires_at rw
-
#expires_at=(expires_at)
rw
Sets the
::ActiveSupport::Cache
entry’s #expires_at value. - #expires_in rw
-
#expires_in=(expires_in)
rw
Sets the
::ActiveSupport::Cache
entry’s #expires_in value. - #version rw
- #version=(version) rw
Constructor Details
.new(options) ⇒ WriteOptions
This method is for internal use only.
# File 'activesupport/lib/active_support/cache.rb', line 1070
def initialize( ) # :nodoc: @options = end
Instance Attribute Details
#expires_at (rw)
[ GitHub ]# File 'activesupport/lib/active_support/cache.rb', line 1094
def expires_at @options[:expires_at] end
#expires_at=(expires_at) (rw)
Sets the ::ActiveSupport::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.
# File 'activesupport/lib/active_support/cache.rb', line 1101
def expires_at=(expires_at) @options.delete(:expires_in) @options[:expires_at] = expires_at end
#expires_in (rw)
[ GitHub ]# File 'activesupport/lib/active_support/cache.rb', line 1082
def expires_in @options[:expires_in] end
#expires_in=(expires_in) (rw)
Sets the ::ActiveSupport::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.
# File 'activesupport/lib/active_support/cache.rb', line 1089
def expires_in=(expires_in) @options.delete(:expires_at) @options[:expires_in] = expires_in end
#version (rw)
[ GitHub ]# File 'activesupport/lib/active_support/cache.rb', line 1074
def version @options[:version] end