класс ActiveSupport::Cache::WriteOptions
Позволяет динамически настраивать параметры записи Cache, гарантируя, что конфликтующие параметры не будут заданы одновременно. Если в ActiveSupport::Cache::Store#fetch передан блок, вторым аргументом будет экземпляр WriteOptions.
Публичные методы экземпляра
# File activesupport/lib/active_support/cache.rb, line 1157 def expires_at @options[:expires_at] end
# File activesupport/lib/active_support/cache.rb, line 1164 def expires_at=(expires_at) @options.delete(:expires_in) @options[:expires_at] = expires_at end
Задаёт значение expires_at для записи Cache. Если ранее был задан параметр expires_in, он будет сброшен, поскольку expires_at и expires_in нельзя задавать одновременно.
# File activesupport/lib/active_support/cache.rb, line 1145 def expires_in @options[:expires_in] end
# File activesupport/lib/active_support/cache.rb, line 1152 def expires_in=(expires_in) @options.delete(:expires_at) @options[:expires_in] = expires_in end
Задаёт значение expires_in для записи Cache. Если ранее был задан параметр expires_at, он будет сброшен, поскольку expires_in и expires_at нельзя задавать одновременно.
# File activesupport/lib/active_support/cache.rb, line 1137 def version @options[:version] end
# File activesupport/lib/active_support/cache.rb, line 1141 def version=(version) @options[:version] = version end
© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.