Permalink
Browse files

Support pluggable cache stores.

[#5486 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
1 parent 0f94ca3 commit 90d4a192854ca7eee0d4bd56d6008ee5b457d2a0 @mperham mperham committed with jeremy Aug 28, 2010
Showing with 9 additions and 2 deletions.
  1. +1 −1 activesupport/CHANGELOG
  2. +8 −1 activesupport/lib/active_support/cache.rb
@@ -1,6 +1,6 @@
*Rails 3.0.0 (unreleased)*
-* No changes
+* Pluggable cache stores: setting config.cache_store = "custom_store" will require 'active_support/cache/custom_store' and look for the CustomStore constant. #5486 [Mike Perham]
*Rails 3.0.0 [release candidate 2] (August 23rd, 2010)*
@@ -58,7 +58,14 @@ def self.lookup_store(*store_option)
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

0 comments on commit 90d4a19

Please sign in to comment.