diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-02-14 18:23:54 -0500 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-02-14 18:23:54 -0500 |
commit | 957ca2ed4cd355198374cff19eff0e9a15af4fef (patch) | |
tree | d8a1e6109269daabadf35d10d056d758a19b7d72 /activesupport/lib/active_support/cache.rb | |
parent | fa9e791e014a650f5ea6a14b283fed9621fc83e2 (diff) | |
parent | dc407392cd6527a9902e91efabedbdced43594e1 (diff) | |
download | rails-957ca2ed4cd355198374cff19eff0e9a15af4fef.tar.gz rails-957ca2ed4cd355198374cff19eff0e9a15af4fef.tar.bz2 rails-957ca2ed4cd355198374cff19eff0e9a15af4fef.zip |
Merge pull request #31866 from fatkodima/redis_cache-connection_pool
Add support for connection pooling on RedisCacheStore
Diffstat (limited to 'activesupport/lib/active_support/cache.rb')
-rw-r--r-- | activesupport/lib/active_support/cache.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 2d038dba77..1ea2d0bbf2 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -160,6 +160,23 @@ module ActiveSupport attr_reader :silence, :options alias :silence? :silence + class << self + private + def retrieve_pool_options(options) + {}.tap do |pool_options| + pool_options[:size] = options.delete(:pool_size) if options[:pool_size] + pool_options[:timeout] = options.delete(:pool_timeout) if options[:pool_timeout] + end + end + + def ensure_connection_pool_added! + require "connection_pool" + rescue LoadError => e + $stderr.puts "You don't have connection_pool installed in your application. Please add it to your Gemfile and run bundle install" + raise e + end + end + # Creates a new cache. The options will be passed to any write method calls # except for <tt>:namespace</tt> which can be used to set the global # namespace for the cache. |