diff options
author | Mike Perham <mperham@gmail.com> | 2010-08-28 14:46:15 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-08-28 15:43:10 -0700 |
commit | 390d285ef67e1868aa0af6e86fa1cd59c32e926d (patch) | |
tree | db3a7f6eec3606a2faf4670324ae1b5b78ab0cde /activesupport/lib/active_support/cache.rb | |
parent | 730af4896358d9125dbd7b8384d66460ae839a45 (diff) | |
download | rails-390d285ef67e1868aa0af6e86fa1cd59c32e926d.tar.gz rails-390d285ef67e1868aa0af6e86fa1cd59c32e926d.tar.bz2 rails-390d285ef67e1868aa0af6e86fa1cd59c32e926d.zip |
Support pluggable cache stores.
[#5486 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activesupport/lib/active_support/cache.rb')
-rw-r--r-- | activesupport/lib/active_support/cache.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 8153dd57de..df35540b55 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -58,7 +58,14 @@ module ActiveSupport case store when Symbol store_class_name = store.to_s.camelize - store_class = ActiveSupport::Cache.const_get(store_class_name) + store_class = + begin + require "active_support/cache/#{store}" + rescue LoadError + raise "Could not find cache store adapter for #{store} (#{$!})" + else + ActiveSupport::Cache.const_get(store_class_name) + end store_class.new(*parameters) when nil ActiveSupport::Cache::MemoryStore.new |