Skip to content

Commit

Permalink
Support pluggable cache stores.
Browse files Browse the repository at this point in the history
[#5486 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information
mperham authored and jeremy committed Aug 28, 2010
1 parent 0f94ca3 commit 90d4a19
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion activesupport/CHANGELOG
Original file line number Diff line number Diff line change
@@ -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)*
Expand Down
9 changes: 8 additions & 1 deletion activesupport/lib/active_support/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 90d4a19

Please sign in to comment.