Created
April 9, 2010 20:46
-
-
Save bpoweski/361571 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
memcached_config_path = File.join(Rails.root, 'config', 'memcached.yml') | |
if File.exists?(memcached_config_path) | |
# create a memcache instance with multiple servers | |
memcached_config = YAML::load(File::read(memcached_config_path)) | |
args = [:mem_cache_store] | |
args << memcached_config[:defaults][:servers] | |
args << { :namespace => memcached_config[:defaults][:namespace] } | |
args.flatten! | |
ActionController::Base.cache_store = *args | |
ActionController::Base.perform_caching = true | |
end | |
rescue Exception => e | |
Rails.logger.error("failed to initialize memcache store: #{e}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment