Guest User

Untitled

a guest
May 21st, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. begin
  2. memcached_config_path = File.join(Rails.root, 'config', 'memcached.yml')
  3. if File.exists?(memcached_config_path)
  4.  
  5. # create a memcache instance with multiple servers
  6. memcached_config = YAML::load(File::read(memcached_config_path))
  7. args = [:mem_cache_store]
  8. args << memcached_config[:defaults][:servers]
  9. args << { :namespace => memcached_config[:defaults][:namespace] }
  10. args.flatten!
  11. ActionController::Base.cache_store = *args
  12. ActionController::Base.perform_caching = true
  13. end
  14. rescue Exception => e
  15. Rails.logger.error("failed to initialize memcache store: #{e}")
  16. end
Add Comment
Please, Sign In to add comment