【发布时间】:2012-01-04 20:13:42
【问题描述】:
我需要获取缓存条目的过期时间或创建时间。
这是针对:sitemap index,索引中的每个站点地图都是缓存操作。我想添加
<lastmod> 属性,在我的例子中是缓存条目的创建时间。
例如对于动作缓存:
class ProductsController < ActionController
caches_action :index
def index
@products = Product.all
end
end
我需要这样的东西:
Rails.cache.get(:controller=>'products',:action=>'index').created_at
【问题讨论】:
-
您是否要扫描缓存?众所周知,Rails 内置了缓存扫描功能。
-
@DevinM 用于站点地图索引,我编辑了问题。
标签: ruby-on-rails ruby-on-rails-3 caching