views:

512

answers:

2

Is there any way of using Memcached for fragment caching in Rails?

+1  A: 

You can set the fragment_cache_store in your environment.rb

  ActionController::Base.cache_store = ActiveSupport::Cache::MemCacheStore.new()

http://api.rubyonrails.org/classes/ActionController/Caching.html#M000628

TonyLa
you should be careful setting it in environment.rb, your development.rb can overwrite it with perform_caching=false, i think it's better to put it in development.rb
Brian Armstrong
+2  A: 

you can add this to your development.rb and it should do fragment caching as well as the others

config.action_controller.perform_caching = true
config.cache_classes = true
config.cache_store = :mem_cache_store
Brian Armstrong