允许在 Cache 条目选项的动态配置,同时确保不会同时设置冲突的选项。当为 ActiveSupport::Cache::Store#fetch 提供块时,第二个参数将是 WriteOptions 的实例。
方法
实例公共方法
expires_at() 链接
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/cache.rb, line 1157 def expires_at @options[:expires_at] end
expires_at=(expires_at) 链接
设置 Cache 条目的 expires_at 值。如果之前设置了 expires_in 选项,则会将其取消设置,因为 expires_at 和 expires_in 不能同时设置。
来源: 显示 | 在 GitHub 上
# 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_in() 链接
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/cache.rb, line 1145 def expires_in @options[:expires_in] end
expires_in=(expires_in) 链接
设置 Cache 条目的 expires_in 值。如果之前设置了 expires_at 选项,则会将其取消设置,因为 expires_in 和 expires_at 不能同时设置。
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/cache.rb, line 1152 def expires_in=(expires_in) @options.delete(:expires_at) @options[:expires_in] = expires_in end
version() 链接
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/cache.rb, line 1137 def version @options[:version] end
version=(version) 链接
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/cache.rb, line 1141 def version=(version) @options[:version] = version end