4

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

Codebeef
  • 43,508
  • 23
  • 86
  • 119

2 Answers2

7

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
  • 19,707
  • 17
  • 115
  • 144
2

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
  • 746
  • 4
  • 6
  • 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 Jun 23 '09 at 20:13