启用 Cache
条目选项的动态配置,同时确保不会同时设置冲突的选项。当块被赋予 ActiveSupport::Cache::Store#fetch
时,第二个参数将是 WriteOptions
的一个实例。
方法
实例公共方法
expires_at() 链接
源代码: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/cache.rb, line 1096 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 1103 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 1084 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 1091 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 1076 def version @options[:version] end
version=(version) 链接
来源:显示 | 在 GitHub 上
# File activesupport/lib/active_support/cache.rb, line 1080 def version=(version) @options[:version] = version end