2014-03-07 43 views
0

Rails 3的多個緩存存儲有什麼區別?具體Rails的緩存存儲有什麼區別?

  • Rails.application.config.cache_store
  • 的ActionController :: Base.cache_store
+1

這很好地解釋了這裏http://guides.rubyonrails.org/v2.3.11/caching_with_rails.html – Pavan

+0

@Pavan,不,它不是。該文章描述了不同類型的緩存存儲(例如memory_store,file_store等),但並未解釋Rails.application.config.cache_store與ActionController :: Base.cache_store的不同之處。 – nickh

回答

0

他們通常沒有什麼不同。據我所知,ActionController::Base.cache_store使用Rails.application.config.cache_store,除非它被告知不要。

+0

這不是我的經驗。當我將'Rails.application.config.cache_store'設置爲'redis_store'並且不設置'ActionController :: Base.cache_store'時,後者設置爲'file_store'並且視圖片段使用'file_store'緩存。當我交換這些值時,視圖片段使用'redis_store'進行緩存。 – nickh

相關問題