Skip to content

Instantly share code, notes, and snippets.

@sssionggg
Created October 1, 2010 10:40
Show Gist options
  • Select an option

  • Save sssionggg/606041 to your computer and use it in GitHub Desktop.

Select an option

Save sssionggg/606041 to your computer and use it in GitHub Desktop.
From 995b8ba05516a3e8d53db30b153da38382dbc15d Mon Sep 17 00:00:00 2001
From: siong1987 <siong1987@gmail.com>
Date: Fri, 1 Oct 2010 05:18:34 -0500
Subject: [PATCH] update memcached store.
---
Gemfile | 2 +-
Gemfile.lock | 4 ++--
config/environment.rb | 1 +
config/environments/production.rb | 4 +---
4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/Gemfile b/Gemfile
index 9c53d36..0d6f0f7 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,7 +3,7 @@ source :rubygems
group :rails do
gem 'rails', '~> 2.3.5', :require => nil
gem 'builder', '~> 2.1.2'
- gem 'memcache-client', '>= 1.7.4', :require => nil
+ gem 'memcached-northscale', :require => 'memcached'
gem 'tzinfo', '~> 0.3.12'
gem 'i18n', '>= 0.1.3'
gem 'tmail', '~> 1.2.3'
diff --git a/Gemfile.lock b/Gemfile.lock
index c3569d4..8bd1261 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -70,7 +70,7 @@ GEM
rake (>= 0.8.1)
libxml-ruby (1.1.3)
linecache (0.43)
- memcache-client (1.8.5)
+ memcached-northscale (0.19.5.4)
mime-types (1.16)
mongrel (1.1.5)
cgi_multipart_eof_fix (>= 2.4)
@@ -158,7 +158,7 @@ DEPENDENCIES
json
launchy (~> 0.3.5)
libxml-ruby (= 1.1.3)
- memcache-client (>= 1.7.4)
+ memcached-northscale
mongrel (~> 1.1.5)
mysql (~> 2.8.1)
oauth
diff --git a/config/environment.rb b/config/environment.rb
index 53d394e..477b2ed 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -2,6 +2,7 @@ require File.expand_path('../boot', __FILE__)
require 'teambox'
Bundler.require(:default, RAILS_ENV)
+require 'memcached'
Teambox::Initializer.run do |config|
config.action_view.sanitized_allowed_tags = 'table', 'th', 'tr', 'td'
diff --git a/config/environments/production.rb b/config/environments/production.rb
index c693964..815c28c 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -18,9 +18,7 @@ config.action_view.cache_template_loading = true
# Use a different cache store in production
if ENV['MEMCACHE_SERVERS']
# Heroku setup: heroku addons:add memcached
- memcache_config = ENV['MEMCACHE_SERVERS'].split(',')
- memcache_config << { :namespace => ENV['MEMCACHE_NAMESPACE'] }
- config.cache_store = :mem_cache_store, memcache_config
+ config.cache_store = :mem_cache_store, Memcached::Rails.new
else
config.cache_store = :file_store, Rails.root + "tmp/cache"
end
--
1.7.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment