gem 'httpclient'
# Load memcache in case we are using it
-gem 'memcache-client'
-gem 'memcached'
+gem 'memcached', '>= 1.4.1'
# Gems needed for running tests
group :test do
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.2.7)
- arel (3.0.1)
+ arel (3.0.2)
builder (3.0.0)
cocaine (0.2.1)
coffee-rails (3.2.2)
httpclient (2.2.4)
i18n (0.6.0)
iconv (0.1)
- journey (1.0.2)
+ journey (1.0.3)
jquery-rails (2.0.0)
railties (>= 3.2.0.beta, < 5.0)
thor (~> 0.14)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- memcache-client (1.8.5)
- memcached (1.3.7)
+ memcached (1.4.1)
mime-types (1.17.2)
multi_json (1.1.0)
multipart-post (1.1.5)
multi_json (~> 1.0)
open_id_authentication (1.1.0)
rack-openid (~> 1.3)
- paperclip (2.6.0)
+ paperclip (2.7.0)
activerecord (>= 2.3.0)
activesupport (>= 2.3.2)
cocaine (>= 0.0.2)
mime-types
- pg (0.13.1)
+ pg (0.13.2)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.1)
iconv
jquery-rails
libxml-ruby (>= 2.0.5)
- memcache-client
- memcached
+ memcached (>= 1.4.1)
oauth-plugin (>= 0.4.0.pre7)
open_id_authentication (>= 1.1.0)
paperclip (~> 2.0)
# Use a different cache store in production
if defined?(MEMCACHE_SERVERS)
- MEMCACHE = Memcached::Rails.new(MEMCACHE_SERVERS, :binary_protocol => true)
- config.cache_store = :mem_cache_store, MEMCACHE
+ config.cache_store = :mem_cache_store, MemCache.new(:namespace => "rails:cache")
end
# Enable serving of images, stylesheets, and JavaScripts from an asset server
+++ /dev/null
-if defined?(PhusionPassenger) and defined?(MEMCACHE_SERVERS)
- PhusionPassenger.on_event(:starting_worker_process) do |forked|
- if forked
- MEMCACHE = MEMCACHE.clone
- RAILS_CACHE = ActiveSupport::Cache::MemCacheStore.new(MEMCACHE, :compress => true)
- ActionController::Base.cache_store = RAILS_CACHE
- end
- end
-end
--- /dev/null
+class MemCache < Memcached::Rails
+ DEFAULT_OPTIONS = Memcached::DEFAULTS.merge(Memcached::Rails::DEFAULTS)
+
+ MemCacheError = Memcached::Error
+
+ @@connections = []
+
+ def initialize(options = {})
+ options.reverse_merge! :binary_protocol => true, :namespace_separator => ":"
+
+ super(MEMCACHE_SERVERS, options)
+
+ @@connections.push(self)
+
+ ObjectSpace.define_finalizer(self, lambda { |connection|
+ @@connections.remove(connection)
+ })
+ end
+
+ def self.connections
+ @@connections
+ end
+end
+
+if defined?(PhusionPassenger)
+ PhusionPassenger.on_event(:starting_worker_process) do |forked|
+ if forked
+ MemCache.connections.each { |connection| connection.reset }
+ end
+ end
+end