diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2014-01-03 13:43:16 -0800 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2014-01-03 13:43:16 -0800 |
commit | 88c3fd1ef1f3bbd4f8fdc15887cc382a287fbd10 (patch) | |
tree | 3af6b6433215c77247b87b64a2e2587f512484b0 /activesupport/lib | |
parent | 05a81c5fe2efe08a171cd3dbef3873c1f0e5fae3 (diff) | |
parent | e7f56a7fe8fbb10e62a18b836c27aa1a0f7c5464 (diff) | |
download | rails-88c3fd1ef1f3bbd4f8fdc15887cc382a287fbd10.tar.gz rails-88c3fd1ef1f3bbd4f8fdc15887cc382a287fbd10.tar.bz2 rails-88c3fd1ef1f3bbd4f8fdc15887cc382a287fbd10.zip |
Merge pull request #13583 from arthurnn/mem_cache_store_fix
mem_cache_store requires dalli, so only accept dalli/client
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/cache/mem_cache_store.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/cache/mem_cache_store.rb b/activesupport/lib/active_support/cache/mem_cache_store.rb index 512296554f..0eacc4c078 100644 --- a/activesupport/lib/active_support/cache/mem_cache_store.rb +++ b/activesupport/lib/active_support/cache/mem_cache_store.rb @@ -41,17 +41,15 @@ module ActiveSupport # # If no addresses are specified, then MemCacheStore will connect to # localhost port 11211 (the default memcached port). - # - # Instead of addresses one can pass in a MemCache-like object. For example: - # - # require 'memcached' # gem install memcached; uses C bindings to libmemcached - # ActiveSupport::Cache::MemCacheStore.new(Memcached::Rails.new("localhost:11211")) def initialize(*addresses) addresses = addresses.flatten options = addresses.extract_options! super(options) - if addresses.first.respond_to?(:get) + unless [String, Dalli::Client, NilClass].include?(addresses.first.class) + raise ArgumentError, "First argument must be an empty array, an array of hosts or a Dalli::Client instance." + end + if addresses.first.is_a?(Dalli::Client) @data = addresses.first else mem_cache_options = options.dup |