Created
June 29, 2010 16:28
-
-
Save stve/457437 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace :cache do | |
| namespace :fragment do | |
| desc 'Manually remove all fragment caches' | |
| task :delete => :environment do | |
| ActionController::Base.cache_store.clear | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def initialize_cache | |
| unless defined?(RAILS_CACHE) | |
| silence_warnings { Object.const_set "RAILS_CACHE", ActiveSupport::Cache.lookup_store(configuration.cache_store) } | |
| if RAILS_CACHE.respond_to?(:middleware) | |
| # Insert middleware to setup and teardown local cache for each request | |
| configuration.middleware.insert_after(:"ActionController::Failsafe", RAILS_CACHE.middleware) | |
| end | |
| end | |
| end | |
| def initialize_framework_caches | |
| if configuration.frameworks.include?(:action_controller) | |
| ActionController::Base.cache_store ||= RAILS_CACHE | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment